
Could you provide the whole configuration file please? On 10.04.2012 19:58, Y M wrote:
(Sorry, message issues, trying again)
Hello,
I had this code well tested when I wrote it months ago, but now it is failing. The only issue is the SiftingAppender:
<appender name="SIFTING" class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator class="ch.qos.logback.classic.sift.MDCBasedDiscriminator">
<key>userId</key>
<defaultValue>none</defaultValue>
</discriminator>
<sift>
<appender name="SIFTING-${userId}" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log_dir}/sifting/log.${userId}.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern>
<maxHistory>30</maxHistory>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>25MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder><pattern>%date %-5level %logger %X{userId} - %message%n%xThrowable{full}</pattern></encoder>
</appender>
</sift>
</appender>
It is simply not logging anything at all. The startup info is short, maybe indicating that it is not being properly initialized:
10:29:18,102 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[MAIN] - File property is set to [null]
10:29:18,102 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.sift.SiftingAppender]
10:29:18,107 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [SIFTING]
10:29:18,107 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [package.project.x] to false
...
10:29:18,727 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN
10:29:18,727 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [MAIN] to Logger[ROOT]
10:29:18,727 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [SIFTING] to Logger[package.project]
10:29:18,727 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
I was upgrading from logback 1.0 to 1.0.1 to use 'cleanHistoryOnStart' when I noticed this. I rolled back to 1.0, but nothing changed. Following other mails and messages around, I tried my RollingFileAppender by itself, and it works fine. The MDC is also fine, as it is printed in my other appenders. I also used<statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> , but nothing useful.
Right now I have no idea how to proceed or how can I investigate this further.
Any help is appreciated.
Thanks!
-- Ceki http://twitter.com/#!/ceki