Did this happen, if so how do I drive it. Just to clarify:
This is what I have DEBUG|0222-164903753|main|foo.LogStuff|1fac9d11-484a-4fda-8bbf-fa1b9cb5d73c|bCodeGoesHere|cCodeGoesHere|||hello world ERROR|0222-164903753|main|foo.LogStuff|1fac9d11-484a-4fda-8bbf-fa1b9cb5d73c|bCodeGoesHere|cCodeGoesHere|||Something bad happened java.lang.Exception: hahahahaha at com.foo.LogStuff.logStuff(LogStuff.java:32) at com.foo.Startup.main(Startup.java:12) This is what I want DEBUG|0222-164903753|main|foo.LogStuff|1fac9d11-484a-4fda-8bbf-fa1b9cb5d73c|bCodeGoesHere|cCodeGoesHere|||hello world ERROR|0222-164903753|main|foo.LogStuff|1fac9d11-484a-4fda-8bbf-fa1b9cb5d73c|bCodeGoesHere|cCodeGoesHere|||Something bad happened ERROR|0222-164903753|main|foo.LogStuff|1fac9d11-484a-4fda-8bbf-fa1b9cb5d73c|bCodeGoesHere|cCodeGoesHere|||java.lang.Exception: hahahahaha ERROR|0222-164903753|main|foo.LogStuff|1fac9d11-484a-4fda-8bbf-fa1b9cb5d73c|bCodeGoesHere|cCodeGoesHere||| at com.foo.LogStuff.logStuff(LogStuff.java:32) ERROR|0222-164903753|main|foo.LogStuff|1fac9d11-484a-4fda-8bbf-fa1b9cb5d73c|bCodeGoesHere|cCodeGoesHere||| at com.foo.Startup.main(Startup.java:12) Thanks Paul On Wed, Oct 28, 2015 at 7:11 AM, Ralph Goers <ralph.go...@dslextreme.com> wrote: > 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 Wed, Oct 28, 2015 at 10: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 >