[logback-dev] [JIRA] Commented: (LBCLASSIC-58) Print Logback own erros to System.out if debug is enabled?

Diego Louzán (JIRA) noreply-jira at qos.ch
Fri Aug 8 11:25:26 CEST 2008


    [ http://jira.qos.ch/browse/LBCLASSIC-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10636#action_10636 ] 

Diego Louzán commented on LBCLASSIC-58:
---------------------------------------

The debug attribute does not work because logback will fail to log status errors when the xml file is ill-formed or when some appender fails due to misconfiguration (this last statement about appenders is a generalization based on DBAppender behaviour, it may be the case it's a DBAppender bug).

Suppose a configuration like this one:

<configuration debug="true">
[...]
    <!-- DB appender -->
    <appender name="DB"
            class="ch.qos.logback.classic.db.DBAppender">
        <connectionSource
                class="ch.qos.logback.core.db.JNDIConnectionSource">
            <param name="jndiLocation" value="java:comp/env/jdbc/test-ds"/>
        </connectionSource>
[...]
</configuration>

In my case, running inside tomcat if the jndi location is wrong, logback will silently fail without logging anything. That's why I had to add the StatusPrinter call in the initialization of my app, just logging logback status so I could trace configuration errors.

Besides that, I guess that "debug=true" will also enable other debug statements, which I don't want in a production environment. It's just needed to log logback state, not enabling debug status.

I've seen your last changes adding an event listener in a system property. Maybe it would be interesting to enable the SYSOUT or SYSERR listener by default? In my case, I would need to enable the listener by adding the system property to tomcat initialization script, which is far from ideal. I guess it will be the same in other scenarios, where you can't rely on having control of the initialization script, thus making it difficult to set a system property (j2ee containers for instance). I can't really tell a good solution to this because my knowledge of logback architecture is limited.

> Print Logback own erros to System.out if debug is enabled?
> ----------------------------------------------------------
>
>                 Key: LBCLASSIC-58
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-58
>             Project: logback-classic
>          Issue Type: Improvement
>            Reporter: Anton Tagunov
>            Assignee: Logback dev list
>            Priority: Minor
>
> Hello Ceki, when debug is enabled lots of messages to to System.out anyway.
> Do you think it would be a good idea to also print messages going to StatusManager to System.out?
> Apparently there is huge demand for this feature.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       


More information about the logback-dev mailing list