[logback-user] RollingFileAppender specified in included resource (scouredimage)

scouredimage scouredimage at gmail.com
Fri Sep 11 06:11:09 CEST 2009


Hi José,

Thanks for the reply.

I traced down the problem to a spurious '.' in the path FileNamePattern
element of my rollingPolicy specification (was '.../logs/profile.%d.log.gz'
when it should have been '../logs/profile.%d.log.gz').

Cheers!


José Juan Montiel wrote:
> 
> Hi,
> 
>>> I can't seem to get a RollingFileAppender specified in an included
>>> resource to function (Does not roll over!). Whereas, another
>>> RollingFileAppender in the main logback.xml files works just fine! Any
>>> ideas on what I'm doing wrong here?
> 
> One questions. Where is placed profiler.xml? Near logback.xml? Or in
> other "relative" path? I said, because, rollingPolicy not make a dir, if
> it dosen't exist. Maybe, the relative path of profiler.xml ../log/ doesn't
> exists.
> 
> Hope that helps.
> 
>>> Thanks in advance!
>>>
>>> =logback.xml=
>>> <configuration debug="true">
>>>
>>>     <include resource="profiler.xml"/>
>>>
>>>     <appender name="ConsoleAppender"
>>> class="ch.qos.logback.core.ConsoleAppender">
>>>         <Target>System.out</Target>
>>>         <layout class="ch.qos.logback.classic.PatternLayout">
>>>             <Pattern>%date [%thread] %-5level %logger{26} -
>>> %msg%n%ex{full}</Pattern>
>>>         </layout>
>>>     </appender>
>>>
>>>     <appender name="fileAppender"
>>> class="ch.qos.logback.core.rolling.RollingFileAppender">
>>>         <File>../logs/fetch.log</File>
>>>         <Append>true</Append>
>>>         <Encoding>UTF-8</Encoding>
>>>         <rollingPolicy
>>> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>>>             <FileNamePattern>../logs/fetch.%d.log.gz</FileNamePattern>
>>>             <MaxHistory>30</MaxHistory>
>>>         </rollingPolicy>
>>>         <layout class="ch.qos.logback.classic.PatternLayout">
>>>             <Pattern>%date [%thread] %-5level \(%class{26}:%line\) -
>>> %msg%n%ex{full}</Pattern>
>>>         </layout>
>>>     </appender>
>>>
>>>     <logger name="com.acme" level="trace"/>
>>>
>>>     <root level="info">
>>>         <appender-ref ref="ConsoleAppender"/>
>>>         <appender-ref ref="fileAppender"/>
>>>     </root>
>>>
>>> </configuration>
>>>
>>> =profiler.xml=
>>> <included>
>>>
>>>     <appender name="ProfileAppender"
>>> class="ch.qos.logback.core.rolling.RollingFileAppender">
>>>         <File>../logs/profile.log</File>
>>>         <Append>true</Append>
>>>         <Encoding>UTF-8</Encoding>
>>>         <rollingPolicy
>>> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>>>            
>>> <FileNamePattern>.../logs/profile.%d.log.gz</FileNamePattern>
>>>             <MaxHistory>60</MaxHistory>
>>>         </rollingPolicy>
>>>         <layout class="ch.qos.logback.classic.PatternLayout">
>>>             <Pattern>%msg%n</Pattern>
>>>         </layout>
>>>     </appender>
>>>
>>>     <logger name="com.acme.util.profiler" level="info">
>>>         <appender-ref ref="ProfileAppender"/>
>>>     </logger>
>>>
>>> </included>
>>> [file:/foo/bar/WEB-INF/classes/logback.xml]
>>> 19:45:47,106 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will
>>> use the pattern .../logs/profile.%d.log for the active file
>>> 19:45:47,112 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - The
>>> date pattern is 'yyyy-MM-dd' from file name pattern
>>> '.../logs/profile.%d.log.gz'.
>>> 19:45:47,226 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will
>>> use the pattern ../logs/server.%d.log for the active file
>>> 19:45:47,227 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - The
>>> date pattern is 'yyyy-MM-dd' from file name pattern
>>> '../logs/server.%d.log.gz'.
> 
> -- 
> Jose Juan Montiel Martinez
> Eurobits Technologies
> Calle Musgo 3, 1ª Planta
> 28023 Madrid
> T +34-917080300
> F +34-913077480
> josejuan.montiel at eurobits.es
> http://www.eurobits.com
> _______________________________________________
> 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/Re%3A-RollingFileAppender-specified-in-included-resource-%28scouredimage%29-tp25378892p25394774.html
Sent from the Logback User mailing list archive at Nabble.com.



More information about the Logback-user mailing list