A couple of new features have been added that should help you: 1. Log4j now supports a PatternSelector so you can have multiple patterns specified for an appender. 2. A new unreleased feature (it will be in 2.5) is the ability to using Scripting on the PatternSelector. With that you can write a script and if the LogEvent contains an exception then you would choose the Pattern that includes the MDC information.
Ralph > On Oct 28, 2015, at 3:56 AM, Paul Sowden <psow...@gmail.com> wrote: > > Hi folks, > > I'm looking to migrate from log4j1 to 2 and i'm wondering if there's any way > of making MDC prefixes appear on all stack trace lines. In 1 I had to > override subAppend in RollingFileAppender and I'm hoping I don't need to go > through similar pain in 2. > > Thanks > Paul --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org