[logback-user] Add custom MDCConverter to PatternLayout used for SyslogAppender on startup

mr.martin.schneider at gmail.com mr.martin.schneider at gmail.com
Tue Apr 1 10:42:01 CEST 2014


Hi all,

I have got a question about how it's possible to add a custom MDCConverter on startup even if no PatternLayoutEncoder is used?

I have got configured a SyslogAppender (no PatternLayout possible) which uses a custom MDCConverter. How is it possible to publish this
converter by adding to ch.qos.logback.classic.PatternLayout.defaultConverterMap without having other appenders? If e. g. console or file
appenders are defined (with custom pattern layout which adds MDCConverter) but not used, adding to the map is done in PatternLayoutEncoder
and everything works fine.

One (dirty?) solution I found is to add the Converter to the map with the definition of e. g.
<define name=“syslogMdcConverterActivator” class="my.package.SyslogMdcConverterActivator" />

Any suggestions?

Thanks,
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20140401/147d5c16/attachment.html>


More information about the Logback-user mailing list