Reputation: 35
I am getting error in c++ program while using log4cxx. The error message is:
error:Please initialize the log4cxx system properly
Please help to resolve,
Thanks in advance.
Upvotes: 0
Views: 4211
Reputation: 29174
AFAIR you have to configure the log4cxx system at the beginning of your program, e.g. using a BasicConfigurator
as shown in this Short introduction to Apache log4cxx:
#include "log4cxx/logger.h"
#include "log4cxx/basicconfigurator.h"
#include "log4cxx/helpers/exception.h"
using namespace log4cxx;
using namespace log4cxx::helpers;
LoggerPtr logger(Logger::getLogger("MyApp"));
int main(int argc, char **argv)
{
// Set up a simple configuration that logs on the console.
BasicConfigurator::configure();
LOG4CXX_INFO(logger, "Entering application.");
// ...
return 0;
}
HTH Martin
Upvotes: 1