Is there any way in nodejs to print log4js output in JSON format?
<p>I am trying to get output of log4js in JSON format so I can easily trace it.
Is there any way that we have to set in configuration.json so output produced by log4js will be in JSON format?</p>

<p>Currently I am using following config.</p>

<pre><code>{
 "appenders": [
{
  "category": "XXXXX",
  "type": "dateFile",
  "filename": "XXXXXXXX",
  "pattern": "-from-MM-dd",
  "layout": {
    "type": "messagePassThrough"
  }
},
{
  "category": "XXXXXXXXX",
  "type": "dateFile",
  "filename": "XXXXXXXX",
  "pattern": "-from-MM-dd",
  "layout": {
    "type": "messagePassThrough"
  }
}
 ],
"levels": {
"XXXXConfig":  "INFO",
"XXXXXjectConfig" : "INFO"
 }
}
</code></pre>

<p>and I got output is in following format : </p>

<pre><code>DEBUG:  1458562784032 : 2016-03-21T12:19:44.4444+00:00 : Data in request: : {
"action": "XXXXXXX",
"user": {
    "username": "XXXX",
     "id" : XXXX,
    "pos" : XXXX
},
"version": 111
}
</code></pre>

<p>instead I want it in (Something like following structure) : </p>

<p>{"id" : "1458562784032", "time" : "2016-03-21T12:19:44.4444+00:00", "message" : "Data in request:", "data" : "{
    "action": "XXXXXXX",
    "user": {
        "username": "XXXX",
         "id" : XXXX,
        "pos: : XXXX
    },
    "version": 111
    }" }</p>

<p>May be there is something I missing in config.</p>

<p>Thanks for helping.</p>