|
Issue Type:
|
Bug
|
Affects Versions:
|
1.0.6 |
Assignee:
|
Logback dev list
|
Components:
|
logback-access |
Created:
|
29/Sep/12 5:00 AM
|
Description:
|
RollingFileAppender is not worked inside siftingAppender when using logback-access!!!
logback-access.xml:
<configuration>
<property scope="context" name="ACCESS_NORMAL_PATTERN" value="%t{HH:mm:ss}|%9reqCookie{userid}|%20(%remoteIP:%remotePort)|%5b|%3s|%U|%reqParameter|%responseContentSimple{1,LHB}" />
<appender name="access_file" class="ch.qos.logback.access.sift.SiftingAppender">
<Discriminator>
<Key>launchName2</Key>
<FieldName>LAUNCH_NAME2</FieldName>
<DefaultValue>unknown</DefaultValue>
</Discriminator>
<sift>
<appender name="ROLLING-${launchName2}" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>logs/${launchName2}/rolling.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<FileNamePattern>logs/${launchName2}/rolling.%i.log</FileNamePattern>
<MinIndex>1</MinIndex>
<MaxIndex>300</MaxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>20MB</MaxFileSize>
</triggeringPolicy>
<encoder>
<Pattern>${NORMAL_PATTERN}</Pattern>
</encoder>
</appender>
</sift>
</appender>
<appender-ref ref="access_file" />
</configuration>
if I use the RollingFileAppender inside the siftingAppender, it can create the "access.log" file only,but the file is empty,nothing is wrote.
however,if I change the RollingFileAppender to FileAppender, like:
<appender name="SIFTING" class="ch.qos.logback.access.sift.SiftingAppender">
<Discriminator>
<Key>launchName</Key>
<FieldName>LAUNCH_NAME2</FieldName>
<DefaultValue>unknown</DefaultValue>
</Discriminator>
<sift>
<appender name="${launchName}" class="ch.qos.logback.core.FileAppender">
<File>logs/${launchName}.log</File>
<layout class="ch.qos.logback.access.PatternLayout">
<Pattern>${ACCESS_NORMAL_PATTERN}</Pattern>
</layout>
</appender>
</sift>
</appender>
the logback-access works well.
the sifingAppender can create different FileAppender for each ${launchName}!
these appenders using in logback-classic are perfect,I don't know why they can't work in logback-access!
actually, "ch.qos.logback.access.sift.SiftingAppender" and "ch.qos.logback.classic.sift.SiftingAppender"
are extended "ch.qos.logback.core.sift.SiftingAppenderBase", they are just different from the Discriminator,
they should work in the same way.
and the RollingFileAppender is in the ch.qos.logback.core package, the ways to use in logback-classic and logback-access are the same.
so, I can not tell where is the problem. For help!!!emergency!!! I love logback!
|
Environment:
|
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
|
Project:
|
logback
|
Labels:
|
logging
logback-access
siftingAppender
rollingFileappender
|
Priority:
|
Critical
|
Reporter:
|
yuanhaoliang
|
|
|