On 16/09/2013 17:51, Francesco Chicchiriccò wrote:
Hi all,
I am currently using the following code to dynamically update log
level at runtime, after init:
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
LoggerConfig logger = SyncopeConstants.ROOT_LOGGER.equals(name)
?
ctx.getConfiguration().getLoggerConfig(LogManager.ROOT_LOGGER_NAME)
: ctx.getConfiguration().getLoggerConfig(name);
logger.setLevel(level);
ctx.updateLoggers();
AFAICT, I can see that the level is actually updated after
"ctx.updateLoggers()" using the following code (forgive the
'System.out.println', it's just temporary...):
for (LoggerConfig logger :
ctx.getConfiguration().getLoggers().values()) {
final String loggerName =
LogManager.ROOT_LOGGER_NAME.equals(logger.getName())
? SyncopeConstants.ROOT_LOGGER : logger.getName();
System.out.println("Found logger '" + loggerName + "' with
level " + logger.getLevel());
}
Unfortunately, the level change is not effective: setting some
logger's level to DEBUG does not change anything in the log files.
Am I doing something wrong? Thanks for your support.
Hi all,
it seems that yesterday I was making some stupid mistake: I confirm
everything works as expected.
Regards.
--
Francesco Chicchiriccò
ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
http://people.apache.org/~ilgrosso/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]