Hi,
I'm trying to get log4j 2.0 debug information printed out in the console
but I couldn't manage to get them.
In log4j 1.x you would set the system property "log4j.debug".
I thought that the mechanism was similar in log4j 2.x and apparently it
should be by setting
log4j2.StatusLogger.level=DEBUG
Still nothing, so I dug a little bit in the code and found that the
StatusLogger logs its messages either to the listeners (if there's at
least one) or to a SimpleLogger (logger) which is initialized in the
constructor (method StatusLogger#logMessage()).
I found that there was a JMX listener registered so I disabled JMX beans
with
log4j2.disable.jmx=true
but still no luck: the messages don't appear in the console.
I noticed though that the constructor might be the source of the problem:
private StatusLogger() {
this.logger = new SimpleLogger("StatusLogger", Level.ERROR,
false, true, false, false, Strings.EMPTY, null, PROPS,
System.err);
this.listenersLevel = Level.toLevel(DEFAULT_STATUS_LEVEL,
Level.WARN).intLevel();
}
The SimpleLogger is initialized using level ERROR therefore the
isEnabled implementation in StatusLogger returns the logging level of
this.logger which is always ERROR even if I wanted DEBUG.
Would it make sense to use DEFAULT_STATUS_LEVEL to actually set the
level into the SimpleLogger constructor?
Why is it so hard to get debug messages showing up in the console (I
mean disable JMX and set the property to DEBUG)?
Best,
Marco Cosentino
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org