logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remko Popma <remko.po...@gmail.com>
Subject Re: log4j 2.0 - About StatusLogger logging level and console output
Date Thu, 31 Jul 2014 22:04:11 GMT
All you need to do is set status="trace" in your log4j2.xml config file. 

So the beginning of your config looks like this:
<Configuration status="trace" ...

Sent from my iPhone

> On 2014/08/01, at 1:13, Marco Cosentino <cosentino.ma@gmail.com> wrote:
> 
> 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-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message