JSON logging from Scala

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

JSON logging from Scala

Surendar Chandra
My log4j configuration is:

<JsonLayout complete="false" compact="true" eventEol="true"
locationInfo="false" properties="true" propertiesAsList="true"

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, key2=value2}
logger.fatal(new StringMapMessage(map))
   ....  "message":"key1=\"value1\" key2=\"value2\""

It always prints the toString value and never the JSON value. What am
I doing wrong?

Thanks much

To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]