Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.7, 2.8, 2.8.1, 2.8.2, 2.9.0, 2.9.1
Description
The Logback JSON Encoder has a feature which allows to specify JSON fields with fixed values. Link: https://github.com/logstash/logstash-logback-encoder#loggingevent_custom_global
Example:
<encoder class="net.logstash.logback.encoder.LogstashEncoder"> <customFields>{"appname":"myWebservice","roles":["customerorder","auth"],"buildinfo":{"version":"Version 0.1.0-SNAPSHOT","lastcommit":"75473700d5befa953c45f630c6d9105413c16fe1"}}</customFields> </encoder>
This is a very convenient way to specify fixed attributes like application, service or environment.
So far I don't see such a possibility in log4j.
Attachments
Issue Links
- relates to
-
LOG4J2-667 Add customization for JSON Layout keys and values
- Open
-
LOG4J2-1752 Add ISO8601 format to timestamp in JSONLayout
- Open
- links to