[logback-user] logback-classic and Tomcat

Zach Cox zcox522 at gmail.com
Mon Jan 5 17:52:07 CET 2009


Hi Ceki,

Yep Tomcat produces /var/log/tomcat6/catalina.YYYY-MM-DD.log files,
but they only contain Tomcat-related logging messages; there are no
messages from my apps.  Maybe I'm doing something wrong in my
logback.xml?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

    <!-- Log messages to console -->
    <appender class="ch.qos.logback.core.ConsoleAppender"
name="RootConsoleAppender">
        <layout class="ch.qos.logback.classic.PatternLayout">
            <Pattern>%d{HH:mm:ss} %-5p %c{36} - %m%n</Pattern>
        </layout>
    </appender>

    <!-- Log messages to a new file every day -->
    <appender class="ch.qos.logback.core.rolling.RollingFileAppender"
name="RootFileAppender">
        <append>true</append>
        <rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>myapp.%d.log</fileNamePattern>
        </rollingPolicy>
        <layout class="ch.qos.logback.classic.PatternLayout">
            <pattern>%d{yyyy-MM-dd HH:mm:ss} %p %c - %m%n</pattern>
        </layout>
    </appender>

    <root>
        <level value="DEBUG" />
        <appender-ref ref="RootFileAppender" />
        <appender-ref ref="RootConsoleAppender" />
    </root>

</configuration>


Also, I forgot to mention that I'm using logback-classic 0.9.9.  Any more ideas?

Thanks,
Zach


On Mon, Jan 5, 2009 at 11:44 AM, Ceki Gulcu <ceki at qos.ch> wrote:
> Hello Zach,
>
> In principle, as far as logback-classic configuration is concerned, the same
> configuration applies for application deployed under Tomcat or Jetty.
>
> Note that Tomcat redirects console output to a file called catalina.out under
> $TOMCAT_HOME/logs/ directory. Have you looked there?
>
> HTH,
>
> Zach Cox wrote:
>> I'm using Logback Classic pretty much everywhere in my code to log
>> lots of things (mainly exceptions and debug messages).  I do *not* use
>> Logback Access at all.  I develop this webapp locally using an
>> embedded Jetty instance, and the logging works fine: all logging
>> messages are written out to the Eclipse console as expected.
>>
>> But on production we're using Tomcat 6.0.18 (installed on Ubuntu 8.10
>> using apt) and I can't find any log files with logback messages
>> anywhere.  I'm sure I just have some settings wrong somewhere - can
>> anyone tell me how to configure logback *classic* (not access) to
>> actually write out logging messages to a log file under Tomcat 6.0.18?
>>
>> Thanks,
>> Zach
>
> --
> Ceki Gülcü
> Logback: The reliable, generic, fast and flexible logging framework for Java.
> http://logback.qos.ch
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
>


More information about the Logback-user mailing list