I created a new Logger object as follows:
log4cplus::Logger m_WebAccessLogger; //a class member
Then in the constructor initialization list do:
m_WebAccessLogger(log4cplus::Logger::getInstance("WebAccess")
This works great, it logs in as expected. I'm having problems with the fact that I want to configure the log4cplus.properties file so that everything for "WebAccess" goes to a separate log file (right now it goes to the default log file, where everything goes).
I can not find documentation on how to configure these properties files, so I need help, please!
Here are my current log properties, how can I say that "WebAccess" goes to another file?
log4cplus.rootLogger=DEBUG, ROLLING log4cplus.appender.STDOUT=log4cplus::ConsoleAppender log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout log4cplus.appender.STDOUT.layout.ConversionPattern=%d{%m/%d/%y %H:%M:%S} [%t] %-5p %c{2} %%%x%% - %m [%l]%n log4cplus.appender.STDOUT.layout.ConversionPattern=%d{%H:%M:%S} [%t] - %m%n log4cplus.appender.ROLLING=log4cplus::RollingFileAppender log4cplus.appender.ROLLING.MaxFileSize=5MB log4cplus.appender.ROLLING.MaxBackupIndex=5
Sort of:
WebAccess.File = c: \ projects \ ArchiveService \ webaccess.log
or
log4cplus.WebAccess.File = webaccess.log
I know that log4cplus is simulative for log4j, so I put it as a tag for this.
source share