[logback-user] Custom LayoutWrappingEncoder question

Tony Trinh tony19 at gmail.com
Tue Jan 17 21:39:08 CET 2012


See below

On Tue, Jan 17, 2012 at 3:10 PM, Adam Gordon <adam.n.gordon at gmail.com>wrote:

> I'm using a custom LayoutWrappingEncoder to colorize and selectively
> timestamp my log file entries.  This encoder is configured via the
> <encoder> element in my logback XML file.  My question is, with a custom
> encoder, is there a way I can specify a <layout> element in my <encoder>
> element and use the built in layout patterns?
>
> I've tried:
>
>     <encoder class="com.bar.foo.CustomLayoutWrappingEncoder">
>       <layout class="ch.qos.logback.classic.PatternLayout">
>         [level] - %logger{15}: %message%n x%Ex{full}
>       </layout>
>     </encoder>
>
>
I think you're missing the <pattern> tag. Try this:

    <encoder class="com.bar.foo.CustomLayoutWrappingEncoder">
      <layout class="ch.qos.logback.classic.PatternLayout">
       * <pattern>*[level] - %logger{15}: %message%n %xEx{full}*</pattern>*
      </layout>
    </encoder>


>  But I'm seeing the following error in the console when testing that:
>
> 13:06:58,318 |-ERROR in ch.qos.logback.classic.PatternLayout("null") -
> Empty or null pattern.
>
> Am I doing this correctly?
>
> Thanks,
>
> --adam
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20120117/7555b865/attachment.html>


More information about the Logback-user mailing list