[logback-user] Custom LayoutWrappingEncoder question

Adam Gordon adam.n.gordon at gmail.com
Tue Jan 17 22:32:38 CET 2012


I was missing the <pattern> element.  Adding got rid of the error message,
but my output is not being formatted.  It's like its ignoring the pattern
and layout.

--adam

http://gordonizer.com



On Tue, Jan 17, 2012 at 13:39, Tony Trinh <tony19 at gmail.com> wrote:

> 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
>>
>
>
> _______________________________________________
> 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/151753e8/attachment.html>


More information about the Logback-user mailing list