[logback-user] SiftingAppender not working
Y M
ym119162 at hotmail.com
Wed Apr 11 17:41:34 CEST 2012
Hi,
Just discovered my mistake... my 'log_dir' was missing scope definition, the breaking change from 1.0.I really don't know how it went unnoticed while using 1.0, maybe I upgraded to 1.0 without proper testing.
As a note, maybe adding some warning info during logback startup could be useful on such situations, when a variable is missing. I had similar issues a couple times, because of typos or some missing startup argument, and I usually realized my mistake by stumbling on the "_is_undefined" folder (like now).
Thanks for your time, ceki.
Kind regards.
> Date: Tue, 10 Apr 2012 23:30:36 +0200
> From: ceki at qos.ch
> To: logback-user at qos.ch
> Subject: Re: [logback-user] SiftingAppender not working
>
>
> 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
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20120411/d2ba0b13/attachment-0001.html>
More information about the Logback-user
mailing list