[logback-user] Multiple layouts for a single appender/encoder

ceki ceki at qos.ch
Thu May 24 12:22:30 CEST 2012

On 18.05.2012 23:59, Y M wrote:

 > Approaches tried: to create an encoder that holds a level-layout,
 > later a level-encoder map, and choose the appropriate object inside
 > 'doEncode'- the question is that some initialization is needed on
 > layouts and encoders, including a context on both situations, and
 > sharing this context between all these objects does not seem to work,
 > not sure why. Using a map of encoders I tried to use them separately
 > for encoding sharing the same context, no good-- with a map of layouts
 > I tried to replace my encoder's layout with the appropriate one, then
 > back to the original layout, and it also does not work. I'm not even
 > posting my code here, as I believe this is the wrong way to implement
 > this.
 > Also, just now reading the archive, I noticed that the previous
 > messages, from Shane Kelly, are basically the same issue as mine with
 > a different approach. Hopefully a solution can fit both.

I think is the easiest approach would be to use evaluators within the 
ThrowableConverter. All the supporting code is already there.



More information about the Logback-user mailing list