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.

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.