Stuart,
I understand what you mean now. It definately creates the dynamic appender
on append. I've been reading the source that does that,
SiftingAppenderBase, today looking at another issue.
I can see why it wouldn't make sense to ido it in MDC.put(). Maybe there is
another way?
I take if your encoder is dynamic, so can't be specified in logback.xml.
- Maybe you can do it with a logback.groovy file, I've heard that is more
flexible.
- Maybe you could define many appenders, one for each encoder, and then use
a filter to control which one the event goes to?
- Maybe you could use a variable name in the encoder class name, which is
replaced by the sifter before the appender is created? Annoyingly
SiftingApender only works on one key at a time, so this might not work for
you.
David