[logback-user] debug output when using Groovy configuration
sw at stinemail.com
Mon Jun 17 04:34:24 CEST 2013
Is there any feedback on the pull request mentioned below?
On May 12, 2013, at 12:58 PM, Dan Stine <sw at stinemail.com> wrote:
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:
>> 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.
>> 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:
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
I added the corresponding info statements in the same pull request:
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  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.
Logback-user mailing list
Logback-user at qos.ch
More information about the Logback-user