I'm new to log4cplus. I have the following configuration:
log4cplus.rootLogger=TRACE, STDOUT
log4cplus.logger.zios.utl.Thread=DEBUG, STDOUT
log4cplus.appender.STDOUT=log4cplus::ConsoleAppender
log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout
log4cplus.appender.STDOUT.layout.ConversionPattern=%d{%H:%M:%S} [%t] - %m%n
which I load with the following code:
try {
log4cplus::PropertyConfigurator::doConfigure("log4cplus.properties");
} catch (...) {
cout << "exception occured while opening log4cplus.properties" << endl;
}
It loads without incident but whenever I log something, I get two messages appearing in my log. For example, I log using this code:
Logger log = Logger::getInstance("zios.utl.Thread");
LOG4CPLUS_DEBUG(log, "Thread created");
and what appears in the log is:
17:10:48 [3075459952] - Thread created
17:10:48 [3075459952] - Thread created
Any idea why this is happening?
You have one appender and you use it twice, for two loggers:
This means that the appender is attached to root logger and
zios.utl.Thread
logger.