[logback-user] debug output when using Groovy configuration

Dan Stine sw at stinemail.com
Mon Jun 17 04:34:24 CEST 2013


Hi,

Is there any feedback on the pull request mentioned below?

https://github.com/qos-ch/logback/pull/124

Thanks,
Dan

On May 12, 2013, at 12:58 PM, Dan Stine <sw at stinemail.com> wrote:

Hi Ceki,

On 2013-05-10 04:02, ceki wrote:
> 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.

I have submitted an attempt at this change:
https://github.com/qos-ch/logback/pull/124

I had to use GafferConfigurator instead of ConfigurationDelegate.  I tried to copy/paste cleanly, but did have to account for the fact that (as far as I can see) there is no per-file "debug" attribute in the Groovy DSL.

>> 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).

I added the corresponding info statements in the same pull request:
https://github.com/qos-ch/logback/pull/124

The new messages look like this:
12:46:21,918 |-INFO in ch.qos.logback.classic.gaffer.ConfigurationDelegate at 3ea909c7 - Setting level of ROOT logger to INFO
12:46:21,928 |-INFO in ch.qos.logback.classic.gaffer.ConfigurationDelegate at 2830e58e - Attaching appender named [STDOUT] to Logger[ROOT]

>> 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.

Okay, thanks for the quick response!  I targeted the pull request at the 1.0.x branch, since master seems to be aimed at a future 1.1 release.  Please let me know if I should do something differently.

While we're talking, I have another question that does not concern debug output, but does concern Gaffer.  I found your comment in this thread [1] that "file inclusion is not supported by Gaffer out-of-the-box".  Is there a standard approach that people use to do this?  Is there an open feature request?  We might have bandwidth to look into it (no promises) but I'd like to get the lay of the land first.

Dan

[1] http://logback.10977.n7.nabble.com/Externalized-Logback-configuration-for-web-applications-td3629.html

_______________________________________________
Logback-user mailing list
Logback-user at qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-user


More information about the Logback-user mailing list