0

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.

Björn Pollex
  • 75,346
  • 28
  • 201
  • 283
balaji
  • 35
  • 2
  • 4

1 Answers1

1

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

MartinStettner
  • 28,719
  • 15
  • 79
  • 106