[logback-user] RollingFileAppender specified in included resource

scouredimage scouredimage at gmail.com
Sat Sep 5 21:02:33 CEST 2009


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? 

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>

=debug log=
19:45:46,708 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could
NOT find resource [logback-test.xml]
19:45:46,709 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found
resource [logback.xml] at [file:/foo/bar/WEB-INF/classes/logback.xml]
19:45:46,893 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
About to instantiate appender of type
[ch.qos.logback.core.rolling.RollingFileAppender]
19:45:46,910 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
Naming appender as [ProfileAppender]
19:45:46,974 |-INFO in
ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Pushing component
[rollingPolicy] on top of the object stack.
19:45:46,982 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Adding
parent to RollingPolicy: ProfileAppender
19:45:47,103 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use
gz compression
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,112 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Roll-over
at midnight.
19:45:47,173 |-INFO in
ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Pushing component
[layout] on top of the object stack.
19:45:47,196 |-INFO in
ch.qos.logback.core.rolling.RollingFileAppender[ProfileAppender] - Active
log file name: ../logs/profile.log
19:45:47,196 |-INFO in
ch.qos.logback.core.rolling.RollingFileAppender[ProfileAppender] - File
property is set to [../logs/profile.log]
19:45:47,208 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
Popping appender named [ProfileAppender] from the object stack
19:45:47,209 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction -
Setting level of logger [com.acme.util.profiler] to INFO
19:45:47,209 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction -
Setting additivity of logger [com.acme.util.profiler] to true
19:45:47,209 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction -
Attaching appender named [ProfileAppender] to Logger[com.acme.util.profiler]
19:45:47,212 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
19:45:47,214 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
Naming appender as [ConsoleAppender]
19:45:47,217 |-INFO in
ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Pushing component
[layout] on top of the object stack.
19:45:47,225 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
Popping appender named [ConsoleAppender] from the object stack
19:45:47,225 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
About to instantiate appender of type
[ch.qos.logback.core.rolling.RollingFileAppender]
19:45:47,225 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
Naming appender as [fileAppender]
19:45:47,226 |-INFO in
ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Pushing component
[rollingPolicy] on top of the object stack.
19:45:47,226 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Adding
parent to RollingPolicy: fileAppender
19:45:47,226 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use
gz compression
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'.
19:45:47,227 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Roll-over
at midnight.
19:45:47,227 |-INFO in
ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Pushing component
[layout] on top of the object stack.
19:45:47,228 |-INFO in
ch.qos.logback.core.rolling.RollingFileAppender[fileAppender] - Active log
file name: ../logs/server.log
19:45:47,228 |-INFO in
ch.qos.logback.core.rolling.RollingFileAppender[fileAppender] - File
property is set to [../logs/server.log]
19:45:47,228 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
Popping appender named [fileAppender] from the object stack
19:45:47,228 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction -
Setting level of logger [com.acme] to TRACE
19:45:47,228 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction -
Setting additivity of logger [com.acme] to true
19:45:47,228 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction
- Setting level of ROOT logger to INFO
19:45:47,228 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction -
Attaching appender named [ConsoleAppender] to Logger[root]
19:45:47,228 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction -
Attaching appender named [fileAppender] to Logger[root]
19:45:47,228 |-INFO in
ch.qos.logback.classic.joran.action.ConfigurationAction - End of
configuration.


-- 
View this message in context: http://www.nabble.com/RollingFileAppender-specified-in-included-resource-tp25301436p25301436.html
Sent from the Logback User mailing list archive at Nabble.com.



More information about the Logback-user mailing list