Oh. But if listeners.size() <= 0 statuslogger calls logger.logMessage() where logger is a SimpleLogger (to the console). You're saying that doesn't work?
Sent from my iPhone > On 2014/08/03, at 16:58, Ralph Goers <[email protected]> wrote: > > Nope. The ConsoleListener is only added when there is a status attribute on a > configuration element. StatusLogger doesn’t ever register a ConsoleListener > itself. StatusConfiguration in core does that. > > Ralph > >> On Aug 3, 2014, at 12:39 AM, Remko Popma <[email protected]> wrote: >> >> I haven't looked at the code but I thought that's what one of those sys >> props did... >> >> Sent from my iPhone >> >>> On 2014/08/03, at 14:57, Ralph Goers <[email protected]> wrote: >>> >>> What he may really want is a way to register the console listener earlier - >>> via a system property. >>> >>> Ralph >>> >>>> On Aug 1, 2014, at 12:24 AM, Remko Popma <[email protected]> wrote: >>>> >>>> Ok. Take a look at the system properties section of the Configuration >>>> manual page. There seem to be two settings. I'm not sure which to use: >>>> Log4jDefaultStatusLevel or log4j2.StatusLogger.level. >>>> >>>> Sent from my iPhone >>>> >>>>> On 2014/08/01, at 16:15, Marco Cosentino <[email protected]> wrote: >>>>> >>>>> Hi Remko, >>>>> thanks for the reply. >>>>> I'd still like something which can be enabled through system preoperties >>>>> and logs at very early stages, for example, where the config is read from. >>>>> >>>>> Marco. >>>>> >>>>>> On 08/01/2014 12:04 AM, Remko Popma wrote: >>>>>> 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 <[email protected]> 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: [email protected] >>>>>>> For additional commands, e-mail: [email protected] >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: [email protected] >>>>>> For additional commands, e-mail: [email protected] >>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: [email protected] >>>>> For additional commands, e-mail: [email protected] >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
