[logback-user] Job Logger configuration

Matt Young solid at youngdev.net
Fri Oct 11 22:45:15 CEST 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I hear ya on the sifting appender only accepting 1 key.  And I changed
the jobId to  MDC.put("fname",jobGroup+"/"+jobName+"/"+jobId ); which
does work with the following configuration:
 <appender name="jobLoggerAppender"
class="ch.qos.logback.classic.sift.SiftingAppender">
    <discriminator
class="ch.qos.logback.classic.sift.MDCBasedDiscriminator">
         <key>fname</key>
        <defaultValue>unknown</defaultValue>
    </discriminator>
        <sift>
            <appender  name="SIFT_INTERNAL"
class="ch.qos.logback.core.FileAppender">
            <prudent>true</prudent>
                <file>${fname}.log</file>
                  <encoder
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
                        <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level
[%thread] %C:%L %msg%n</pattern>
                    </encoder>
            </appender>
        </sift>
    </appender>

What concerns me is that I don't seem to be able to override the
MDCAdapter that logback uses for the sifting.  The documentation says
that the class="..." attribute should override the MDCAdapter
implementation used.  but it doesn't.  No matter what I put in that
class attribute, it always uses
ch.qos.logback.classic.util.LogbackMDCAdapter

I looked at the source for that MDCAdapter implementation and have
confirmed that it does only use one value but that the MDCBasicAdapter
from slf4j supports multiple keys.  What is preventing me from using the
better implementation from SLF4J?

On 10/11/2013 05:35 AM, David Roussel wrote:


- -- 
Cheers,
Matt Young
solid at youngdev.net
http://youngdev.net

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJSWGNbAAoJEO5jycTTPEzccQEP/29NN/dUMkxhik0ya+w9sebW
SOEZMQvfltWEEuf+tCLR/dfaVobvPDq6tMHtE5vV+p0Eve/RLaoxBemiDr/Lp14i
AfAgDn5h+LFNMpGsL9QwiOJnM/uVn/yefiwTc4yeRfNTgF/aR52i6EVyRLy3b4fN
jfkieohJ0BftXhUuLWpBcdDJUiIYK6w9YLrK1Hu5/LgCmmYcQPramddDsv1mrTGm
/NicfKMiMriSALL2kRJY+/v2mnWmSzTWprXA30k9WM0q0cKWDQJuhqCnuU8CQ22M
3VablhdkuZE+tSMmcAcm0T6lp8fBtfvIM8d5G4vXAVcHx4c6yx96txUjgz2yAFdg
03/ge5YBVux2qWdfY+9jNbDWpKyOzb5MZ8X/VWbmAr0uSuIyoJUo76HFTH2hq8mn
5JfNmLhTNJiLp0qMFpSmaarw20ligO1PRn4N2EqAGlNUoGG43wnyMn+inGxJjVmJ
cHN26KpetRHAFj5lJ/ggfP2Khr8Fn637yoEyzmtB6PQPTmj0RFZkz8DjBxIRDETU
tw/VYfC+VtJyzaNG1JtfDOjErbA6VpywpzHhrklB+jaQX1nGGDfzOsndmU13R8X/
b7WziN3+ptatd7ErcAecFeOR5sxTj3nI/qpYgilZmlfU68F+XA7foeCp1VPw8DqX
m4w9WsFmFPrUUfuwZAfA
=HuWJ
-----END PGP SIGNATURE-----



More information about the Logback-user mailing list