ops4j / org.ops4j.pax.logging

The OSGi Logging framework implementation. Supports SLF4J,LOG4J,JCL etc.
https://ops4j1.jira.com/wiki/spaces/paxlogging/overview
Apache License 2.0
47 stars 79 forks source link

[2.1.x] Wrap log4j JsonTemplateLayout in pax-logging-log4j2 #459

Closed jbonofre closed 2 years ago

jbonofre commented 2 years ago

We just have to include a new log4j artifact in the wrapping (no additional dependency should be required).

jbonofre commented 2 years ago

Other additional log4j-* artifacts could be included this way.

grgrzybek commented 2 years ago

Thanks @svogt for the PR! I've added an integration test for this layout. Here's properties-based configuration:

json.template.log4j2.appender.file.type = File
json.template.log4j2.appender.file.name = file
json.template.log4j2.appender.file.fileName = target/logs-log4j2/json-template.log
json.template.log4j2.appender.file.append = true
json.template.log4j2.appender.file.layout.type = JsonTemplateLayout
json.template.log4j2.appender.file.layout.eventTemplateUri = ${karaf.etc.uri}/logging-template.json

json.template.log4j2.rootLogger.level = info
json.template.log4j2.rootLogger.appenderRef.file.ref = file
grgrzybek commented 2 years ago

Backports: