Hi,
we are using the sift logger (with MDC) to separate log entries generated by
user actions from log entries generated by "background" tasks. That works
nicely.
However, now we want to have different log levels for these two appenders (e.g.
DEBUG for "foreground.log" and WARN for "background.log"). Problem is that
there is obviously only one appender. Can that be accomplished within the
logback.xml?
For reference, here is our current logback.xml
<configuration scan="true" scanPeriod="30 seconds">
<appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator
class="ch.qos.logback.classic.sift.MDCBasedDiscriminator">
<key>stream</key>
<defaultValue>foreground</defaultValue>
</discriminator>
<sift>
<appender name="FILE-${stream}"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${destination}/${stream}_current.log</file>
<rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${destination}/${stream}_%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>%date %-5level [%X{token}%thread] %logger{36}
[%file:%line] %msg%n</pattern>
</encoder>
</appender>
</sift>
</appender>
<root level="all">
<appender-ref ref="SIFT" />
</root>
</configuration>
</nk>
---
Norbert Kiesel
Systems Architect | Engineering
MetricStream
2600 E. Bayshore Road | Palo Alto, CA - 94303
+1-650-620-2954 | [email protected] | www.metricstream.com
Confidentiality Notice:This email and any files transmitted with it are
confidential and intended solely for the use of the individual or entity to
whom they are addressed. This message contains confidential information and is
intended only for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please notify the
sender immediately by e-mail if you have received this e-mail by mistake and
delete this e-mail from your system. If you are not the intended recipient you
are notified that disclosing, copying, distributing or taking any action in
reliance on the contents of this information is strictly prohibited
_______________________________________________
Logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user