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
written
.
however
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
SiftingAppender
can create different FileAppender for each ${launchName}
!
.
these
These
appenders using in logback-classic are perfect,I don't know why they can't work in logback-access
!
.
actually
Actually
, "ch.qos.logback.access.sift.SiftingAppender" and "ch.qos.logback.classic.sift.SiftingAppender"
are extended
extend
"ch.qos.logback.core.sift.SiftingAppenderBase"
, they are just different from the
. They only differ on
Discriminator
,
and thus
they
should work
in the same way
similarly
.
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
So
, I can not tell where is the problem. For help!!!emergency!!! I love logback!
|