[logback-user] Tomcat access logs
whatever21
jbakker at veoh.com
Fri Jan 25 19:14:14 CET 2008
I finally fixed the problem. By adding jcl104-over-slf4j-1.4.3.jar to my
WEB-INF/lib directory and editing /TOMCAT_HOME/conf/server.xml to include
the following line:
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
prefix="access." suffix=".log"
pattern='%t %{X-Forwarded-For}i "%U%q" %s %b %D'
resolveHosts="false"
fileDateFormat="yyyy-MM-dd-HH"
/>
I now get access logs handled by apache's logging system and everything else
controlled by logback.
whatever21 wrote:
>
> I added all the jars you suggested in my WEB-INF/lib directory. The
> effect was to route all catalina logging to LOGGINGENGINE, but the access
> logs are still nowhere to be found.
>
>
> Jason Buberel wrote:
>>
>> In our production environment, where we have replaced log4j with logback
>> under tomcat, I have the following:
>>
>> /opt/jakarta-tomcat-5.5.9/server/lib (everything)
>> -rw-rw-r-- 1 jason altos 24746 Mar 26 2005 catalina-ant.jar
>> -rw-rw-r-- 1 jason altos 166594 Mar 26 2005
>> catalina-cluster.jar
>> -rw-rw-r-- 1 jason altos 636165 Mar 26 2005 catalina.jar
>> -rw-rw-r-- 1 jason altos 115234 Mar 26 2005
>> catalina-optional.jar
>> -rw-rw-r-- 1 jason altos 63330 Mar 26 2005
>> catalina-storeconfig.jar
>> -rw-rw-r-- 1 jason altos 109670 Mar 26 2005
>> commons-modeler.jar
>> -rw-rw-r-- 1 jason altos 21642 Mar 26 2005
>> servlets-cgi.renametojar
>> -rw-rw-r-- 1 jason altos 18062 Mar 26 2005
>> servlets-default.jar
>> -rw-rw-r-- 1 jason altos 6008 Mar 26 2005
>> servlets-invoker.jar
>> -rw-rw-r-- 1 jason altos 45677 Mar 26 2005
>> servlets-ssi.renametojar
>> -rw-rw-r-- 1 jason altos 22060 Mar 26 2005
>> servlets-webdav.jar
>> -rw-rw-r-- 1 jason altos 123399 Mar 26 2005 tomcat-ajp.jar
>> -rw-rw-r-- 1 jason altos 19247 Mar 26 2005 tomcat-coyote.jar
>> -rw-rw-r-- 1 jason altos 51679 Mar 26 2005 tomcat-http.jar
>> -rw-rw-r-- 1 jason altos 245885 Mar 26 2005 tomcat-util.jar
>>
>> /opt/jakarta-tomcat-5.5.9/webapps/altos/WEB-INF/lib (logging-related
>> only)
>> -rw-r--r-- 1 jason altos 15435 Aug 26 08:36
>> jcl104-over-slf4j.jar
>> -rw-r--r-- 1 jason altos 9592 Aug 26 08:36
>> log4j-over-slf4j.jar
>> -rw-r--r-- 1 jason altos 70919 Aug 26 08:36
>> logback-access.jar
>> -rw-r--r-- 1 jason altos 120215 Aug 26 08:36
>> logback-classic.jar
>> -rw-r--r-- 1 jason altos 186680 Aug 26 08:36 logback-core.jar
>> -rw-r--r-- 1 jason altos 15345 Aug 26 08:36 slf4j-api.jar
>> -rw-r--r-- 1 jason altos 7011 Aug 26 08:36 slf4j-jcl.jar
>>
>> Does that help?
>>
>> -jason
>>
>>
>>
>> whatever21 wrote:
>>> I forgot to add that I also have logback-classic-0.9.8.jar in my
>>> .../WEB-INF/lib and TOMCAT_HOME/lib directories.
>>>
>>>
>>>
>>> whatever21 wrote:
>>>
>>>> Hi, I'm having some problems getting Tomcat (version 6.0.14) access
>>>> logs
>>>> to work in conjunction with Logback and my other loggers.
>>>>
>>>> This is what my logback.xml looks like (its exploded into
>>>> ../WEB-INF/classes/ when I deploy a new .war):
>>>>
>>>> <configuration debug="true">
>>>>
>>>> <!-- specify directories where logs should live -->
>>>> <substitutionProperty name="logEng.log.dir"
>>>> value="${base.log.dir}/loggingEngine"/>
>>>> <substitutionProperty name="targeting.log.dir"
>>>> value="${base.log.dir}/targeting"/>
>>>> <substitutionProperty name="normalize.log.dir"
>>>> value="${base.log.dir}/normalize"/>
>>>> <substitutionProperty name="cookie.dir"
>>>> value="/home/tomcat/globalHistory"/>
>>>>
>>>> <appender name="LOGGINGENGINE"
>>>> class="ch.qos.logback.core.rolling.RollingFileAppender">
>>>> <file>${logEng.log.dir}/logEng.log</file>
>>>>
>>>> <rollingPolicy
>>>>
>>>> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>>>> <FileNamePattern>
>>>> logEng-%d{yyyy-MM-dd}.log.gz
>>>> </FileNamePattern>
>>>> </rollingPolicy>
>>>>
>>>> <layout class="ch.qos.logback.classic.PatternLayout">
>>>> <Pattern>
>>>> %d{yyyy/MM/dd HH:mm:ss ZZZ}\t%msg%n
>>>> </Pattern>
>>>> </layout>
>>>> </appender>
>>>>
>>>> <appender name="TARGETING"
>>>> class="ch.qos.logback.core.rolling.RollingFileAppender">
>>>> <file>${targeting.log.dir}/targeting.log</file>
>>>>
>>>> <rollingPolicy
>>>>
>>>> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>>>> <FileNamePattern>
>>>> targeting-%d{yyyy-MM-dd}.log.gz
>>>> </FileNamePattern>
>>>> </rollingPolicy>
>>>>
>>>> <layout class="ch.qos.logback.classic.PatternLayout">
>>>> <Pattern>
>>>> %d{yyyy/MM/dd HH:mm:ss ZZZ}\t%msg%n
>>>> </Pattern>
>>>> </layout>
>>>> </appender>
>>>>
>>>> <appender name="NORMALIZE"
>>>> class="ch.qos.logback.core.rolling.RollingFileAppender">
>>>> <file>${normalize.log.dir}/normalize.log</file>
>>>>
>>>> <rollingPolicy
>>>>
>>>> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>>>> <FileNamePattern>
>>>> normalize-%d{yyyy-MM-dd}.log.gz
>>>> </FileNamePattern>
>>>> </rollingPolicy>
>>>>
>>>> <layout class="ch.qos.logback.classic.PatternLayout">
>>>> <Pattern>
>>>> %msg%n
>>>> </Pattern>
>>>> </layout>
>>>> </appender>
>>>>
>>>> <appender name="COOKIE"
>>>> class="ch.qos.logback.core.rolling.RollingFileAppender">
>>>> <file>${cookie.dir}/cookie.log</file>
>>>>
>>>> <rollingPolicy
>>>>
>>>> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>>>> <FileNamePattern>
>>>> cookie-%d{yyyy-MM-dd}.log.gz
>>>> </FileNamePattern>
>>>> </rollingPolicy>
>>>>
>>>> <layout class="ch.qos.logback.classic.PatternLayout">
>>>> <Pattern>
>>>> %msg%n
>>>> </Pattern>
>>>> </layout>
>>>> </appender>
>>>>
>>>> <logger name="CookieLog" additivity="false">
>>>> <level value="INFO"/>
>>>> <appender-ref ref="COOKIE"/>
>>>> </logger>
>>>>
>>>> <logger name="TargetingLog" additivity="false">
>>>> <level value="ALL"/>
>>>> <appender-ref ref="TARGETING"/>
>>>> </logger>
>>>>
>>>> <logger name="NormalizeLog" additivity="false">
>>>> <level value="ALL"/>
>>>> <appender-ref ref="NORMALIZE"/>
>>>> </logger>
>>>>
>>>> <root>
>>>> <level value="ALL"/>
>>>> <appender-ref ref="LOGGINGENGINE"/>
>>>> </root>
>>>> </configuration>
>>>>
>>>> My logback configuration works like a charm but I get no access logs
>>>> under
>>>> TOMCAT_HOME/logs
>>>>
>>>> Under TOMCAT_HOME/lib/ I have the usual jars and I've added:
>>>> logback-access-0.9.8.jar
>>>> logback-core-0.9.8.jar
>>>>
>>>> What should I have under ../WEB-INF/lib/?
>>>>
>>>> I don't have much experience with logging in general (which is probably
>>>> apparent :)
>>>>
>>>> Thanks,
>>>> Jennifer
>>>>
>>>>
>>>>
>>>
>>>
>>
>> _______________________________________________
>> Logback-user mailing list
>> Logback-user at qos.ch
>> http://qos.ch/mailman/listinfo/logback-user
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Tomcat-access-logs-tp14946148p15093715.html
Sent from the Logback User mailing list archive at Nabble.com.
More information about the Logback-user
mailing list