AsyncLogger and System.exit() not flushing unless I explicitly call LogManager.shutdown()

2020-07-01 Thread Surendar Chandra
We're using Log4j2 2.12 with AsyncLogger and JsonAppender. If I call System.exit() from uncaught exception handler, sometimes the exception printed before calling System.exit() is not printed on the console. However, if I explicitly call LogManager.shutdown() first, I reliably get the stack trac

Re: Accessing ThreadContext via "$${ctx:ndc}" vs "${ctx:ndc}"

2020-02-20 Thread Surendar Chandra
it will simply strip > the leading $ and you will get ${ctx:ndc}. > > Ralph > > > On Feb 20, 2020, at 12:37 PM, Surendar Chandra > > wrote: > > > > I'm building a JSON log by using something like this in my xml config: > > > > > > >

Accessing ThreadContext via "$${ctx:ndc}" vs "${ctx:ndc}"

2020-02-20 Thread Surendar Chandra
I'm building a JSON log by using something like this in my xml config: If I use a single $, for one particular value, the value seems to be stuck at a constant. Other variables are fine. If I use a double $, then it seems to work in all scenarios. I guess I should be using $$ but why is it flaky

JsonLayout, KeyValuePair and level transformation

2019-11-26 Thread Surendar Chandra
Is there a way to use the following pattern as the value of a keyvalue pair? %level{TRACE=7, DEBUG=7, INFO=6, WARN=4, ERROR=3, Fatal=0} I'm trying to transform the logger level into a integer with JSON. Thanks - To unsubscribe,

JSON logging from Scala

2019-11-25 Thread Surendar Chandra
My log4j configuration is: Regardless of what I specify for objectMessageAsJsonObject, I cannot get it to produce JSON of the message: I am using org.apache.logging.log4j.scala.Logger. I tried with ObjectMessage and StringMapMessage scala> map res5: java.util.Map[String,String] = {key1=value1,