[logback-user] Tomcat 5.5 and LogbackValve

Ceki Gulcu ceki at qos.ch
Fri Aug 7 23:15:20 CEST 2009


Because $TOMCAT_HOME/bin is the current working directory (of the Tomcat 
process) and you are telling logback-access to write to a file called 
"access.log" which is presumed to be in the current directory.

wchu wrote:
> Hi,
> 
> Perfect! Thank you!  I found the log file in the $TOMCAT_HOME/bin/
> directory.  That brings up the question of why does the log file output by
> default to the $TOMCAT_HOME/bin directory and not the $TOMCAT_HOME/logs
> directory?
> 
> Regards,
> Will
> 
> 
> 
> Ceki Gulcu wrote:
>>
>> You should see a file called "access.log" in the current directly, or the 
>> directory where Tomcat is started, e.g. $TOMCAT_HOME/bin/.
>>
>> You could perhaps post the contents of your "logback-access.xml" file.
>>
>> wchu wrote:
>>> I have it set to debug and below is what I'm seeing in the log.
>>>
>>> 14:53:04,856 |-INFO in
>>> ch.qos.logback.access.tomcat.LogbackValve[privatehost] - filename
>>> property
>>> not set. Assuming
>>> [/usr/local/apache-tomcat-5.5.27/conf/logback-access.xml]
>>> 14:53:04,887 |-INFO in
>>> ch.qos.logback.access.joran.action.ConfigurationAction - Ignoring debug
>>> attribute.
>>> 14:53:04,887 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
>>> About to instantiate appender of type
>>> [ch.qos.logback.core.rolling.RollingFileAppender]
>>> 14:53:04,893 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
>>> Naming appender as [FILE]
>>> 14:53:04,909 |-INFO in
>>> ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Pushing
>>> component
>>> [rollingPolicy] on top of the object stack.
>>> 14:53:04,912 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Adding
>>> parent to RollingPolicy: FILE
>>> 14:53:04,926 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will
>>> use
>>> zip compression
>>> 14:53:04,926 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will
>>> use
>>> the pattern access.%d{yyyy-MM-dd}.log for the active file
>>> 14:53:04,933 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - The
>>> date
>>> pattern is 'yyyy-MM-dd' from file name pattern
>>> 'access.%d{yyyy-MM-dd}.log.zip'.
>>> 14:53:04,933 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy -
>>> Roll-over
>>> at midnight.
>>> 14:53:04,935 |-INFO in
>>> ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Pushing
>>> component
>>> [triggeringPolicy] on top of the object stack.
>>> 14:53:04,950 |-INFO in
>>> ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Pushing
>>> component
>>> [layout] on top of the object stack.
>>> 14:53:04,955 |-INFO in
>>> ch.qos.logback.core.rolling.RollingFileAppender[FILE]
>>> - Active log file name: access.log"
>>> 14:53:04,955 |-INFO in
>>> ch.qos.logback.core.rolling.RollingFileAppender[FILE]
>>> - File property is set to [access.log"]
>>> 14:53:04,956 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
>>> Popping appender named [FILE] from the object stack
>>> 14:53:04,956 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction
>>> -
>>> Attaching appender named [FILE] to
>>> ch.qos.logback.access.tomcat.LogbackValve[privatehost]
>>> 14:53:04,956 |-INFO in
>>> ch.qos.logback.access.joran.action.ConfigurationAction - End of
>>> configuration.
>>>
>>>
>>>
>>> Ceki Gulcu wrote:
>>>> What do the status messages say?
>>>>
>>>> wchu wrote:
>>>>> Hi,
>>>>>
>>>>> Yes, I did add 
>>>>>
>>>>> <Valve className="ch.qos.logback.access.tomcat.LogbackValve"/>
>>>>>
>>>>> to the server.xml and I do see the internal status printing to the
>>>>> console. 
>>>>> I just don't see the log file being created.
>>>>>
>>>>> Regards,
>>>>> Will
>>>>>
>>>>>
>>>>> Ceki Gulcu wrote:
>>>>>> Hello,
>>>>>>
>>>>>> Have you added
>>>>>>
>>>>>> <Valve className="ch.qos.logback.access.tomcat.LogbackValve"/>
>>>>>>
>>>>>> to server.xml?
>>>>>>
>>>>>> Moreover, is logback-access printing its internal status on the
>>>>>> console?
>>>>>> (It 
>>>>>> does that automatically unless instructed otherwise.)
>>>>>>
>>>>>> BR
>>>>>>
>>>>>> Chu, William wrote:
>>>>>>> Hi all,
>>>>>>>
>>>>>>>  
>>>>>>>
>>>>>>> I tried searching through the archives for any suggestions or answers
>>>>>>> to 
>>>>>>> my dilemma so I must resort to posting this question.
>>>>>>>
>>>>>>>  
>>>>>>>
>>>>>>> I’m attempting to use the LogbackValve with Tomcat 5.5 and I’m not 
>>>>>>> achieving the results that I expected.  What I’d like to do is have 
>>>>>>> Tomcat use LogbackValve instead of 
>>>>>>> org.apache.catalina.valves.FastCommonAccessLogValve.  I attempted to 
>>>>>>> follow the instructions detailed on this page, 
>>>>>>> http://logback.qos.ch/access.html#tomcat, but to no avail.  No log
>>>>>>> file 
>>>>>>> is created in the TOMCAT_HOME/logs directory which I would expect it
>>>>>>> to 
>>>>>>> do upon startup of Tomcat.  What am I missing?
>>>>>>>
>>>>>>>  
>>>>>>>
>>>>>>> Line in server.xml:
>>>>>>>
>>>>>>> <Valve className="ch.qos.logback.access.tomcat.LogbackValve"/>
>>>>>>>
>>>>>>>  
>>>>>>>
>>>>>>> Logback-access.xml:
>>>>>>>
>>>>>>> <configuration debug=”true”>
>>>>>>>
>>>>>>>   <appender name="FILE"
>>>>>>>
>>>>>>>     class="ch.qos.logback.core.rolling.RollingFileAppender">
>>>>>>>
>>>>>>>     <File>access.log"</File>
>>>>>>>
>>>>>>>     <rollingPolicy
>>>>>>>
>>>>>>>       class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>>>>>>>
>>>>>>>      
>>>>>>> <FileNamePattern>access.%d{yyyy-MM-dd}.log.zip</FileNamePattern>
>>>>>>>
>>>>>>>     </rollingPolicy>
>>>>>>>
>>>>>>>  
>>>>>>>
>>>>>>>                 <triggeringPolicy 
>>>>>>> class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
>>>>>>>
>>>>>>>                                 <MaxFileSize>5MB</MaxFileSize>
>>>>>>>
>>>>>>>                 </triggeringPolicy>
>>>>>>>
>>>>>>>     <layout class="ch.qos.logback.access.PatternLayout">
>>>>>>>
>>>>>>>       <Pattern>combined</Pattern>
>>>>>>>
>>>>>>>     </layout>
>>>>>>>
>>>>>>>   </appender>
>>>>>>>
>>>>>>>  
>>>>>>>
>>>>>>>   <appender-ref ref="FILE" />
>>>>>>>
>>>>>>> </configuration>
>>>>>>>
>>>>>>>  
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>>  
>>>>>>>
>>>>>>> *William Chu*
>>>>>>>
>>>>>>> Sr. Applications Developer
>>>>>>>
>>>>>>> First American CoreLogic, Inc.
>>>>>>>
>>>>>>>  
>>>>>>>
>>>>>>> cid:830400118 at 10072008-0D3C
>>>>>>>
>>>>>>> Direct: 714.250.5813
>>>>>>>
>>>>>>> Email: wchu at facorelogic.com
>>>>>>>
>>>>>>>  
>>>>>>>
>>>>>>> ****************************************************************************************** 
>>>>>>> This message may contain confidential or proprietary information
>>>>>>> intended
>>>>>>> only for the use of the 
>>>>>>> addressee(s) named above or may contain information that is legally
>>>>>>> privileged. If you are 
>>>>>>> not the intended addressee, or the person responsible for delivering
>>>>>>> it
>>>>>>> to the intended addressee, 
>>>>>>> you are hereby notified that reading, disseminating, distributing or
>>>>>>> copying this message is strictly 
>>>>>>> prohibited. If you have received this message by mistake, please
>>>>>>> immediately notify us by  
>>>>>>> replying to the message and delete the original message and any
>>>>>>> copies
>>>>>>> immediately thereafter. 
>>>>>>>
>>>>>>> Thank you. 
>>>>>>> ****************************************************************************************** 
>>>>>>> FACLD
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Logback-user mailing list
>>>>>>> Logback-user at qos.ch
>>>>>>> http://qos.ch/mailman/listinfo/logback-user
>>>>>> -- 
>>>>>> 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
>>>>>>
>>>>>>
>>>> -- 
>>>> 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
>>>>
>>>>
>> -- 
>> 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
>>
>>
> 

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch


More information about the Logback-user mailing list