[logback-user] Reference to encoders o patterns?

César Álvarez Núñez cesar.alvarez.nunez at gmail.com
Tue May 11 12:34:28 CEST 2010


Hi All,

Is there some way to make a reference to an encoder or pattern defined
previously via a reference or similar?
I've tried with the bellow configuration but it does not work :-(

<configuration>
    <encoder name="ENC-1"class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
        <Pattern>%date %.-1level [%mdc{SessionID}] [%t] %logger{32} -
%m%n%ex{0}</Pattern>
    </encoder>

    <encoder name="ENC-2"class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
        <Pattern>%date %.-1level [%mdc{SessionID}] [%t] %logger{32} -
%m%n</Pattern>
    </encoder>

    <appender name="STDOUT-1" class="ch.qos.logback.core.ConsoleAppender">
        <encoder-ref ref="ENC-1"/>
    </appender>

    <appender name="STDOUT-2" class="ch.qos.logback.core.ConsoleAppender">
        <encoder-ref ref="ENC-2"/>
    </appender>

    <logger name="X.Y">
        <level value="INFO" />
        <appender-ref ref="STDOUT-2" />
    </logger>

    <root level="DEBUG">
        <appender-ref ref="STDOUT-1" />
    </root>
</configuration>


BR,
/César.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/logback-user/attachments/20100511/dccbe394/attachment-0001.html>


More information about the Logback-user mailing list