[logback-user] SiftingAppender not working
ceki
ceki at qos.ch
Thu Apr 12 09:32:12 CEST 2012
I was suspecting a problem related property scoping. However, when your
affirmation about correct operation with logback v1.0.0 invalidated my
property scoping hypothesis. Hence my request to see the full config file.
On a different register, output from OnConsoleStatusListener should have
provided useful information as to the origin of the problem. I wonder
why OnConsoleStatusListener did not work as it should have.
--
Ceki
http://twitter.com/#!/ceki
On 11.04.2012 17:41, Y M wrote:
> 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!
> > >
> >
More information about the Logback-user
mailing list