You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@karaf.apache.org by Bernhard Schuhmann <be...@gmx.de> on 2015/04/11 22:40:24 UTC

Re: Error while installing log4j2 api on Karaf

Hi,

in case you haven't figured it out in the meantime yourself - Pax Logging
has a separate implementation for the logging service that uses Log4j v2
instead of v1. The implementation is in another bundle pax-logging-log4j2,
the implementation that uses v1 is pax-logging-service. pax-logging-log4j2
re-exports the log4j2 packages.

To get log4j2 working in Karaf, I've changed the Pax logging service bundle
in etc/startup.properties:


The log4j2 service implementation uses the same Config Admin pid, instead of
log4j v1 settings it just contains a reference to the log4j2.xml file.
Change etc/org.ops4j.pax.logging.cfg to



Setting the log level is optional 

To use system properties in log4j's config file, just use the sys: prefix
like



Finally you need to configure the appender from Pax Logging inside log4j's
config xml file (e.g. etc/log4j2.xml) with



Choose the appender name you like, but Pax Logging registers its service
with the name VmLogAppender.



--
View this message in context: http://karaf.922171.n3.nabble.com/Error-while-installing-log4j2-api-on-Karaf-tp4038875p4039566.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.