[logback-dev] using Pattern and Layout on same Encoder is not working

Arriazu, Gustavo gustavo.arriazu at hp.com
Thu Oct 17 20:45:32 CEST 2013


Hi, I'm working in aproject where I need to log same information in different log files.

I have 2 different Appenders, but I need to use only one custom Layout to avoid computing the same information twice
Is there a way to do so? 2 Appenders but only 1 executing layout?

Also, I'm trying to use a Pattern with a custom Layout, but either I get the pattern executed or the Layout,  but not both. How could I get both to work?

This is an example of the configuration of my logback.xml file

<conversionRule conversionWord="OnePattern"
               converterClass="OnePattern" />

<appender name="OneAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
               <File>...</File>
               <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
                              <pattern>%-6OnePattern %nopex%n</pattern>
                              <layout class="CustomLayout">
                              </layout>
               </encoder>
</appender>

Thanks in advance

Gustavo Arriazu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-dev/attachments/20131017/92718f01/attachment.html>


More information about the logback-dev mailing list