jerryshao opened a new pull request, #5407:
URL: https://github.com/apache/gravitino/pull/5407

   ### What changes were proposed in this pull request?
   
   Add org.apache.logging.log4j:log4j-layout-template-json to support server 
log in json format.
   
   ### Why are the changes needed?
   
   There are use cases required server logs to be viewed from logsearch tools 
such as Kibana. These use cases recommends log format to be json.
   
   Based on
   https://logging.apache.org/log4j/2.x/manual/json-template-layout.html, 
`log4j-layout-template-json` is needed to enable json layout for log4j.
   
   Fix: https://github.com/apache/gravitino/issues/5389
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Tested locally with modified lo4j property file.
   ```
   appender.rolling.layout.type = JsonTemplateLayout
   appender.rolling.layout.eventTemplate = 
{"instant":{"$resolver":"timestamp","pattern":{"format":"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'","timeZone":"UTC"}},"level":{"$resolver":"level","field":"name"},"thread":{"$resolver":"thread","field":"name"},"message":{"$resolver":"message","stringified":true},"exception":{"$resolver":"exception","field":"stackTrace","stackTrace":{"stringified":true}}}
   ```
   
   For better usability, json can be passed in via a individual file using 
[eventTemplateUri](https://logging.apache.org/log4j/2.x/manual/json-template-layout.html#plugin-attr-eventTemplateUri)
 instead.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to