Hi,

I have configured log4j2 on Karaf 2.4 as such

- Edit the file etc/startup.properties file and comment this line
`org/ops4j/pax/logging/pax-logging-service/1.8.4/pax-logging-service-1.8.4.jar=8`
- Add this line after the commented line
'org/ops4j/pax/logging/pax-logging-log4j2/1.8.4/pax-logging-log4j2-1.8.4.jar=8'

- Configure `org.ops4j.pax.logging.cfg` file by adding this line
'org.ops4j.pax.logging.log4j2.config.file=${karaf.etc}/log4j2.xml'

- Add a log4j.xml file

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
    <Appenders>
        <Console name="console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{ABSOLUTE} | %-5.5p | %-16.16t |
%-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n"/>
        </Console>
        <RollingFile name="out" fileName="${karaf.data}/log/fuse.log"
              append="true"
filePattern="${karaf.data}/log/$${date:yyyy-MM}/fuse-%d{MM-dd-yyyy}-%i.log.gz">
           <PatternLayout>
             <Pattern>%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32c{1} | %X{
bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n</Pattern>
           </PatternLayout>
           <Policies>
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="250 MB"/>
            </Policies>
        </RollingFile>
        <PaxOsgi name="paxosgi" filter="VmLogAppender"/>
    </Appenders>
    <Loggers>
        <Root level="INFO">
            <AppenderRef ref="console"/>
            <AppenderRef ref="out"/>
            <AppenderRef ref="paxosgi"/>
        </Root>
    </Loggers>
</Configuration>

but when I try to change the log level, I get this error

JBossFuse:karaf@root> log:set DEBUG io.apiman
JBossFuse:karaf@root> 12:22:55,086 | ERROR | s4j.pax.logging) | configadmin
                     | 7 - org.apache.felix.configadmin - 1.8.4 | Cannot
use configuration org.ops4j.pax.logging for
[org.osgi.service.log.LogService, org.knopflerfish.service.log.LogService,
org.ops4j.pax.logging.PaxLoggingService,
org.osgi.service.cm.ManagedService, id=13,
bundle=65/mvn:org.ops4j.pax.logging/pax-logging-service/1.8.4]: No
visibility to configuration bound to
mvn:org.ops4j.pax.logging/pax-logging-log4j2/1.8.4

IS there something else to configure ?

Regards

-- 
Charles Moulliard
Apache Committer & PMC / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io

Reply via email to