Does log4j support JSON format?

前端 未结 4 1375
鱼传尺愫
鱼传尺愫 2021-02-01 03:17

Is it possible to let log4j output its logging in JSON format by only altering the log4j.properties.xml configuration file?
I make use of an old application tha

4条回答
  •  情书的邮戳
    2021-02-01 04:11

    Yes It is possible. Take a look at this link It can generate

    {
       "timestamp":1352412458890,
       "date":"Nov 8, 2012 10:07:38 PM",
       "hostname":"michael1",
       "username":"michael",
       "level":"INFO",
       "thread":"main",
       "classname":"uk.me.mjt.log4jjson.SimpleJsonLayoutTest",
       "filename":"SimpleJsonLayoutTest.java",
       "linenumber":25,
       "methodname":"testDemonstration",
       "message":"Example of some logging"
     }
    

提交回复
热议问题