I've got a properties file for my logger that has the following in it:
log4cplus.logger.memory=TRACE
### next two lines commented out
#log4cplus.appender.memory.layout=log4cplus::PatternLayout
#log4cplus.appender.memory.layout.ConversionPattern=%d{%m/%d/%y %H:%M:%S} [%t]
I want to use it solely to change the log level when the logger is created - the logger already has a rolling file appender attached at startup.
When the file is present - I lose all logging - it appears (I'm guessing) that there are no more appenders.
Here's the code for processing the properties file (called memory.properties). Note the log level DOES appear to change properly, no logs are no longer getting written.
Thanks
lc
// Override logger properties with config file
struct stat buffer;
if (0 == stat(logname.c_str(), &buffer))
{
ostringstream propFile;
propFile << logger_name << ".properties";
log4cplus::PropertyConfigurator::doConfigure(propFile.str());
log4cplus::LogLevel level = __mem_log.getLogLevel();
string lev = log4cplus::getLogLevelManager().toString(level);
ostringstream msg;
msg << "Log level set from memory.properties file to " << lev;
cerr << msg.str() << endl;
__mem_log.forcedLog(log4cplus::TRACE_LOG_LEVEL, msg.str()); // <<< never see this even at TRACE level
}
From: Ciummo, Lawrence
Sent: Tuesday, April 08, 2014 2:34 PM
To: Log...@li...
Subject: Minimixing open files
I'm using many loggers (up to 1000) in my system and want to minimize the number of open files. If I use an appender with a log level range filter (say on a rolling file appender), will the file be opened if there are never any logging events that don't trigger the filter?
Thanks
Larry
|