logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvester <sylvesterste...@gmail.com>
Subject Hi, unable to use Log4Cxx
Date Sat, 22 Nov 2008 06:49:58 GMT
Hi,
This is the first time I am using Log4Cxx. I am using MingW and eclipse 
ganymede, and for the life of me haven't figured out how to use it. I 
have added the .h files to the project they show up in the "includes". 
Then I pasted the following from here 
<http://wiki.apache.org/logging-log4cxx/FrequentlyAskedQuestions>:

#include "log4cxx/logger.h"
#include "log4cxx/helpers/pool.h"
#include "log4cxx/basicconfigurator.h"
#include "log4cxx/fileappender.h"
#include "log4cxx/simplelayout.h"



int main() {
    using namespace log4cxx;
   log4cxx::FileAppender * fileAppender = new
log4cxx::FileAppender(log4cxx::LayoutPtr(new log4cxx::SimpleLayout()),
"logfile", false);

   log4cxx::helpers::Pool p;
   fileAppender->activateOptions(p);

   
log4cxx::BasicConfigurator::configure(log4cxx::AppenderPtr(fileAppender));
   log4cxx::Logger::getRootLogger()->setLevel(log4cxx::Level::getDebug());
   log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger("logger");

   LOG4CXX_INFO(logger,"Created FileAppender appender");

   return 0;
}


Almost every line is marked red! Am I missing something? (I have made 
minor changes in the above)

Sylvester



Mime
View raw message