Hi Matt,
Karaf uses pax-logging 1.8.x which supports log4j2, so basically Karaf
can use log4j2 even if it's not the case by default.
To enable it, you have to:
1. add pax-logging-log4j in etc/startup.properties
2. update etc/org.ops4j.pax.logging.cfg with the following property:
org.ops4j.pax.logging.log4j2.config.file = ${karaf.etc}/log4j2.yaml
# Use asynchronous logger for all loggers
#org.ops4j.pax.logging.log4j2.async = false
NB: you can use other format too
3. create your logger/appender in log4j2.yaml (especially the rootLogger)
I will update the documentation with that.
Regards
JB
On 11/23/2015 12:39 AM, Matt Sicker wrote:
I see that pax-logging has support for log4j2, but it's not enabled by
default in Karaf. I also saw that an old complaint about the support was
lack of support for properties files in configuration, but that was
added to log4j2 in version 2.4. Since pax-logging uses SLF4J as the API
anyway, it seems like it should be easy to use log4j2, but I can't find
any instructions on how to do this.
--
Matt Sicker <[email protected] <mailto:[email protected]>>
--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com