[logback-user] debug output when using Groovy configuration

ceki ceki at qos.ch
Fri May 10 10:02:04 CEST 2013


Hi Dan,

Thank you for your detailed message. Answers in-line.

On 09.05.2013 19:26, sw at stinemail.com wrote:
> Hi,
>
> Thank you for logback and slf4j. We have found them very useful.
>
> I would like to inquire about debugging output, starting with the
> intended behavior of the system property logback.debug.  It appears to
> have no effect if an application is configured via Groovy.  Setting
> logback.statusListenerClass does have some effect, though the output is
> not as verbose as with XML configuration.  I created a sample project
> that demonstrates the differences:
> https://github.com/dstine/logback-debug-groovy.  My experiments use the
> latest released version of logback 1.0.12.

Thank you for going to the trouble of creating this sample project.

> My first question is, should logback.debug behave the same for both XML
> and Groovy configuration?  If yes, my next question is, how would we fix
> this?  I see the following code in ConfigurationAction (XML):

Yes, logback.debug should have the same affect in both config systems.

> https://github.com/qos-ch/logback/blob/71886409e62533af0bdf1d922a7d66f3818d42db/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConfigurationAction.java#L47-L52
>

> It looks like logback.debug is simply a shortcut for adding the status
> listener.  Is that correct, or is there anything else at play?  Should
> we "just" copy this code to ConfigurationDelegate (Groovy), or
> centralize it somehow?

Yes, that is correct. The debug attribute is a shortcut for adding the
OnConsoleStatusListener. Nothing else is at play. Copying to
ConfigurationDelegate sounds good.

> Next, the output for Groovy config appears to not include information
> about configuring loggers, whereas XML config provides this output:
>
> 11:43:58,046 |-INFO in
> ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming
> default type ch.qos.logback.classic.encoder.PatternLayoutEncoder] for
> [encoder] property
> 11:43:58,078 |-INFO in
> ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of
> ROOT logger to DEBUG
> 11:43:58,078 |-INFO in
> ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender
> named [STDOUT] to Logger[ROOT]


Information about setting logger levels is obviously beneficial. I am
surprised to learn that it's missing in Gaffer (the groovy
configurator).

> Last, are there other differences I have not yet noticed?

There is no strict rule mandating that Joran's (the XML configurator)
output match that of Gaffer (the groovy configurator) or vice
versa. If you think useful information is missing or there is too much
information output by either configurator, do not hesitate to make
corrections. From what I can see you are already familiar with git. A
pull request would be the easiest way to send in your fixes.

> Thanks,
> Dan
-- 
Ceki
65% of statistics are made up on the spot


More information about the Logback-user mailing list