You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@karaf.apache.org by Prithviraj <me...@gmail.com> on 2015/03/09 11:41:01 UTC

Error while installing log4j2 api on Karaf

Hi ,

We are using Karaf 3.2. We are using log4j2 , build 2.1 for logging .
While installing log4j2 bundles we are getting below error 

installing log4j-api :- 
bundle:install -s mvn:org.apache.logging.log4j/log4j-api/2.1

Exception :- 

ERROR: Bundle org.apache.logging.log4j.api [272] EventDispatcher: Error
during dispatch. (java.lang.IllegalMonitorStateException)
Bundle ID: 273
java.lang.IllegalMonitorStateException

installing 
bundle:install -s mvn:org.apache.logging.log4j/log4j-core/2.1

Exception :- 

ERROR: Bundle org.apache.logging.log4j.api [272] EventDispatcher: Error
during dispatch. (java.lang.IllegalMonitorStateException)
Bundle ID: 274





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

Re: Error while installing log4j2 api on Karaf

Posted by Bernhard Schuhmann <be...@gmx.de>.
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.

Re: Error while installing log4j2 api on Karaf

Posted by Prithviraj <me...@gmail.com>.
Hi,

I checked pax package present in  local repository , but does not contain
pax-logging-api  also not log4j2 api
It contains  only master, swissbox, url and web bundles



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

Re: Error while installing log4j2 api on Karaf

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

Can you check if pax-logging-api doesn't already provide the log4j2 api ?

Regards
JB

On 03/09/2015 11:41 AM, Prithviraj wrote:
> Hi ,
>
> We are using Karaf 3.2. We are using log4j2 , build 2.1 for logging .
> While installing log4j2 bundles we are getting below error
>
> installing log4j-api :-
> bundle:install -s mvn:org.apache.logging.log4j/log4j-api/2.1
>
> Exception :-
>
> ERROR: Bundle org.apache.logging.log4j.api [272] EventDispatcher: Error
> during dispatch. (java.lang.IllegalMonitorStateException)
> Bundle ID: 273
> java.lang.IllegalMonitorStateException
>
> installing
> bundle:install -s mvn:org.apache.logging.log4j/log4j-core/2.1
>
> Exception :-
>
> ERROR: Bundle org.apache.logging.log4j.api [272] EventDispatcher: Error
> during dispatch. (java.lang.IllegalMonitorStateException)
> Bundle ID: 274
>
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Error-while-installing-log4j2-api-on-Karaf-tp4038875.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com