我在使用log4cxx时遇到c ++程序错误。错误消息是:
error:Please initialize the log4cxx system properly
请帮忙解决,
提前致谢。
答案 0 :(得分:0)
AFAIR您必须在程序开头配置log4cxx系统,例如使用BasicConfigurator
中显示的#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;
}
:
{{1}}
HTH 马丁