[logback-user] Logback and tomcat
cosanta
public at cosanta.com
Fri May 28 21:44:20 CEST 2010
Daniel,
I was running into what looks like a similar problem. I'm trying to
integrate slf4j/logback into a google app engine project. Console logging
works fine when I don't create my own logback.xml. I was using SLF4J 1.5.11
with logback 0.9.19 when I ran across your post. I upgraded to slf4j 1.6.0
and logback 0.9.21 and those specific problems disappeared. Still working
on some others though...
--
Sean
Daniel Proud wrote:
>
> Hi guys,
>
> I am attempting to get logback working with my tomcat webapp and have
> run into a few issues.
>
> I have got various log messages in my client code and they seem to work
> when run seperate from the web app (eg junit testing in eclipse uses the
> default configuration and the log messages appear in the console.)
>
> When I run this code embedded in a webapp on my local tomcat5.5 install
> (from within eclipse again) I can see logback internal messages in the
> eclipse console view:
>
> 23/04/2010 10:15:19 AM org.apache.catalina.core.AprLifecycleListener
> lifecycleEvent
> INFO: The Apache Tomcat Native library which allows optimal performance
> in production environments was not found on the java.library.path:
> C:\Program
> Files\Java\jdk1.6.0_16\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program
> Files (x86)\CollabNet Subversion
> Client;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
> Files (x86)\ATI Technologies\ATI.ACE\Core-Static;c:\Program Files
> (x86)\Microsoft SQL
> Server\90\Tools\binn\;C:\msys\1.0\bin;C:\mingw\bin;C:\cygwin\bin;C:\Program
> Files (x86)\TortoiseHg;C:\Program Files (x86)\Mercurial\;C:\Program
> Files (x86)\CVSNT\
> 23/04/2010 10:15:19 AM org.apache.coyote.http11.Http11BaseProtocol init
> INFO: Initializing Coyote HTTP/1.1 on http-8080
> 23/04/2010 10:15:19 AM org.apache.catalina.startup.Catalina load
> INFO: Initialization processed in 484 ms
> 23/04/2010 10:15:20 AM org.apache.catalina.core.StandardService start
> INFO: Starting service Catalina
> 23/04/2010 10:15:20 AM org.apache.catalina.core.StandardEngine start
> INFO: Starting Servlet Engine: Apache Tomcat/5.5.28
> 23/04/2010 10:15:20 AM org.apache.catalina.core.StandardHost start
> INFO: XML validation disabled
> 23/04/2010 10:15:20 AM org.apache.catalina.loader.WebappClassLoader
> validateJarFile
> INFO:
> validateJarFile(E:\workspaces\default\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\web-keno\WEB-INF\lib\servlet-api-2.4.jar)
> - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:
> javax/servlet/Servlet.class
> 10:15:20,578 |-INFO in ch.qos.logback.classic.LoggerContext[default] -
> Could NOT find resource [logback-test.xml]
> 10:15:20,578 |-INFO in ch.qos.logback.classic.LoggerContext[default] -
> Found resource [logback.xml] at
> [file:/E:/workspaces/default/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/web-keno/WEB-INF/classes/logback.xml]
> 10:15:20,625 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
> About to instantiate appender of type
> [ch.qos.logback.core.rolling.RollingFileAppender]
> 10:15:20,625 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
> Naming appender as [FILE]
> 10:15:20,656 |-INFO in
> ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Pushing
> component [rollingPolicy] on top of the object stack.
> 10:15:20,671 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - No
> compression will be used
> 10:15:20,671 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will
> use the pattern E:/apache-tomcat-5.5.28/logs/keno.%d{yyyy-MM-dd}.log for
> the active file
> 10:15:20,687 |-INFO in
> ch.qos.logback.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy at 755c62bc
> - The date pattern is 'yyyy-MM-dd' from file name pattern
> 'E:/apache-tomcat-5.5.28/logs/keno.%d{yyyy-MM-dd}.log'.
> 10:15:20,687 |-INFO in
> ch.qos.logback.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy at 755c62bc
> - Roll-over at midnight.
> 10:15:20,687 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter at 10:12
> - no applicable action for [encoder], current pattern is
> [[configuration][appender][encoder]]
> 10:15:20,687 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter at 11:13
> - no applicable action for [pattern], current pattern is
> [[configuration][appender][encoder][pattern]]
> 10:15:20,687 |-INFO in
> ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Active log file
> name: E:/apache-tomcat-5.5.28/logs/keno.2010-04-23.log
> 10:15:20,687 |-INFO in
> ch.qos.logback.core.rolling.RollingFileAppender[FILE] - File property is
> set to [null]
> 10:15:20,687 |-ERROR in
> ch.qos.logback.core.rolling.RollingFileAppender[FILE] - No layout set
> for the appender named "FILE".
> 10:15:20,687 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
> Popping appender named [FILE] from the object stack
> 10:15:20,687 |-INFO in
> ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of
> ROOT logger to ALL
> 10:15:20,687 |-INFO in
> ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender
> named [FILE] to Logger[ROOT]
> 10:15:20,687 |-INFO in
> ch.qos.logback.classic.joran.action.ConfigurationAction - End of
> configuration.
>
> 10:15:20,578 |-INFO in ch.qos.logback.classic.LoggerContext[default] -
> Could NOT find resource [logback-test.xml]
> 10:15:20,578 |-INFO in ch.qos.logback.classic.LoggerContext[default] -
> Found resource [logback.xml] at
> [file:/E:/workspaces/default/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/web-keno/WEB-INF/classes/logback.xml]
> 10:15:20,625 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
> About to instantiate appender of type
> [ch.qos.logback.core.rolling.RollingFileAppender]
> 10:15:20,625 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
> Naming appender as [FILE]
> 10:15:20,656 |-INFO in
> ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Pushing
> component [rollingPolicy] on top of the object stack.
> 10:15:20,671 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - No
> compression will be used
> 10:15:20,671 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will
> use the pattern E:/apache-tomcat-5.5.28/logs/keno.%d{yyyy-MM-dd}.log for
> the active file
> 10:15:20,687 |-INFO in
> ch.qos.logback.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy at 755c62bc
> - The date pattern is 'yyyy-MM-dd' from file name pattern
> 'E:/apache-tomcat-5.5.28/logs/keno.%d{yyyy-MM-dd}.log'.
> 10:15:20,687 |-INFO in
> ch.qos.logback.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy at 755c62bc
> - Roll-over at midnight.
> 10:15:20,687 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter at 10:12
> - no applicable action for [encoder], current pattern is
> [[configuration][appender][encoder]]
> 10:15:20,687 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter at 11:13
> - no applicable action for [pattern], current pattern is
> [[configuration][appender][encoder][pattern]]
> 10:15:20,687 |-INFO in
> ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Active log file
> name: E:/apache-tomcat-5.5.28/logs/keno.2010-04-23.log
> 10:15:20,687 |-INFO in
> ch.qos.logback.core.rolling.RollingFileAppender[FILE] - File property is
> set to [null]
> 10:15:20,687 |-ERROR in
> ch.qos.logback.core.rolling.RollingFileAppender[FILE] - No layout set
> for the appender named "FILE".
> 10:15:20,687 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
> Popping appender named [FILE] from the object stack
> 10:15:20,687 |-INFO in
> ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of
> ROOT logger to ALL
> 10:15:20,687 |-INFO in
> ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender
> named [FILE] to Logger[ROOT]
> 10:15:20,687 |-INFO in
> ch.qos.logback.classic.joran.action.ConfigurationAction - End of
> configuration.
>
> 23/04/2010 10:15:20 AM org.apache.axis.utils.JavaUtils
> isAttachmentSupported
> WARNING: Unable to find required classes (javax.activation.DataHandler
> and javax.mail.internet.MimeMultipart). Attachment support is disabled.
> 23/04/2010 10:15:21 AM org.apache.coyote.http11.Http11BaseProtocol start
> INFO: Starting Coyote HTTP/1.1 on http-8080
> 23/04/2010 10:15:21 AM org.apache.jk.common.ChannelSocket init
> INFO: JK: ajp13 listening on /0.0.0.0:8009
> 23/04/2010 10:15:21 AM org.apache.jk.server.JkMain start
> INFO: Jk running ID=0 time=0/47 config=null
> 23/04/2010 10:15:21 AM org.apache.catalina.storeconfig.StoreLoader load
> INFO: Find registry server-registry.xml at classpath resource
> 23/04/2010 10:15:21 AM org.apache.catalina.startup.Catalina start
> INFO: Server startup in 1375 ms
>
> The config does not appear twice when I turn off the debug option in the
> below logback.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <configuration debug="true">
> <appender name="FILE"
> class="ch.qos.logback.core.rolling.RollingFileAppender">
> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
> <FileNamePattern>${catalina.home}/logs/keno.%d{yyyy-MM-dd}.log</FileNamePattern>
> <MaxHistory>30</MaxHistory>
> </rollingPolicy>
>
> <encoder>
> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
> %msg%n</pattern>
> </encoder>
> </appender>
>
> <root level="all">
> <appender-ref ref="FILE" />
> </root>
> </configuration>
>
> However nothing seems to get logged. It creates the log file however it
> remains at 0 bytes. I tried using a console appender and had the same
> problem - the log messages did not appear on the console.
>
> When I try to run the above app on a ubuntu9/tomcat6 production-like
> environment, I get the same issue (no log messages) except I can't find
> the console output at all. I have a feeling that is a tomcat config
> issue though - I can't find catalina.out anywhere.
>
> Any ideas what might be causing the log messages to disappear?
>
> Cheers,
> Dan
> --
> *Daniel Proud*
> Analyst Programmer
> ------------------------------------------------------------------------
> Tel: (02) 6245 6267
> Fax: (02) 6245 6242
> Mob: 0417 291 323
> Email: danielp at acttab.com.au <mailto:danielp at acttab.com.au>
> Web: http://www.acttab.com.au
>
> ACTTAB <http://www.acttab.com.au>
>
> ------------------------------------------------------------------------
>
> The information transmitted is intended only for the person to whom it
> is addressed and may contain confidential and/or privileged material.
> Any review, retransmission, interference with, copying or other use of,
> or taking of any action in reliance on this information by persons other
> than the intended recipient is prohibited. If you have received this
> information in error, please contact the sender immediately and delete
> the material from your computer. It is the recipient’s responsibility to
> check this message and any attachments for viruses.
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
>
>
--
View this message in context: http://old.nabble.com/Logback-and-tomcat-tp28336217p28628266.html
Sent from the Logback User mailing list archive at Nabble.com.
More information about the Logback-user
mailing list