Log4j JSON layout

JSON layout for Log4j

License

License

Categories

Categories

JSON Data
GroupId

GroupId

com.tperamaki
ArtifactId

ArtifactId

log4j-json-layout
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

Log4j JSON layout
JSON layout for Log4j
Project URL

Project URL

https://github.com/tperamaki/log4j-json-layout
Source Code Management

Source Code Management

https://github.com/tperamaki/log4j-json-layout

Download log4j-json-layout

How to add to project

<!-- https://jarcasting.com/artifacts/com.tperamaki/log4j-json-layout/ -->
<dependency>
    <groupId>com.tperamaki</groupId>
    <artifactId>log4j-json-layout</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.tperamaki/log4j-json-layout/
implementation 'com.tperamaki:log4j-json-layout:2.0.0'
// https://jarcasting.com/artifacts/com.tperamaki/log4j-json-layout/
implementation ("com.tperamaki:log4j-json-layout:2.0.0")
'com.tperamaki:log4j-json-layout:jar:2.0.0'
<dependency org="com.tperamaki" name="log4j-json-layout" rev="2.0.0">
  <artifact name="log4j-json-layout" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.tperamaki', module='log4j-json-layout', version='2.0.0')
)
libraryDependencies += "com.tperamaki" % "log4j-json-layout" % "2.0.0"
[com.tperamaki/log4j-json-layout "2.0.0"]

Dependencies

compile (2)

Group / Artifact Type Version
log4j : log4j jar 1.2.17
com.fasterxml.jackson.core : jackson-databind jar 2.9.8

Project Modules

There are no modules declared in this project.

Maven Central

Log4J JSON Layout

A JSON layout for Log4J (v1.2).

Output format

{"timestamp":"<DATE>","level":"<LEVEL>","logger":"<LOGGER>","thread":"<THREAD>","message":"<MESSAGE>","stacktrace":"<STACKTRACE>"}

The "stacktrace" item is optional and will only be in the JSON object if the log message has a trace message.

Example log4j.properties

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=com.tperamaki.log4j.JsonLayout
log4j.appender.stdout.layout.DatePattern=yyyy-MM-dd'T'HH:mm'Z'

Layout configuration

Name Options Default
DatePattern all valid SimpleDateFormat patterns yyyy-MM-dd HH:mm:ss,SSS

Versions

Version
2.0.0
1.0.0