pax-logging-log4j2 configuration ?

757 views
Skip to first unread message

Lutz Suhrbier

unread,
Aug 24, 2015, 2:01:35 PM8/24/15
to OPS4J
Hi,

I am trying to use pax-logging-log4j2. Unfortunately, I could not find any docs. Bbut, from the sources, I found that org.ops4j.pax.logging.log4j2.config.file appears to define the location of the log4j2.xml configuration file.
I configured org.ops4j.pax.logging.log4j2.config.file within org.ops4j.pax.logging.properties and it appears to be consumed when starting the DEBUG org.ops4j.pax.logging.pax-logging-log4j2 service (at least, if a wrong file name is given, an error message ist thrown.

But it seams, that whatever pattern layout or debug level I define in log4j2.xml, none will be used by pax-logging-log4j2. In the runtime environment, I started all four pax-logging services including pax-log4j..

A warning is thrown:
WARN org.eclipse.equinox.cm - Configuration for service.pid=org.ops4j.pax.logging could not be bound to initial@reference:file:../../home/lusu/.eclipse.mars/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.ops4j.pax.logging.pax-logging-log4j2_1.8.3.jar

but a similar warning is thrown when starting log4j(1) services.

My question is, how do I enable the configuration of pax-logging-log4j2.
This is the log4j-config  line in org.ops4j.pax.logging.properties:
org.ops4j.pax.logging.log4j2.config.file=/home/lusu/.eclipse.mars/paxlogger/log4j2.xml

This is my log4j2.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG">
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
        </Console>
    </Appenders>
    <Loggers>
        <Root level="debug">
            <AppenderRef ref="Console" />
        </Root>
    </Loggers>
</Configuration>

Any hints ?

Lutz




Achim Nierbeck

unread,
Aug 24, 2015, 2:32:47 PM8/24/15
to op...@googlegroups.com
Hi Lutz, 

I'm not sure, but your 

I started all four pax-logging services including pax-log4j..

makes we wonder, afaik you just need the pax-logging-api and one of the following "service" bundles: 

- pax-logging-service (the default log4j based bundle)
- pax-logging-log4j2 (the one for log4j2)
- pax-logging-logback (the one using logback as logger)

as you already found yourself, you just need to define the external configuration file in the 
org.ops4j.pax.logging.properties

regards, Achim 




--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master 

Niclas Hedhman

unread,
Aug 25, 2015, 11:44:18 PM8/25/15
to op...@googlegroups.com

Since the complaint is about the PID, I suspect that it is missing a Configuration Admin service.

// Niclas
Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java
Reply all
Reply to author
Forward
0 new messages