Hi That’s normal : log:* commands only work with default log4j properties style.
Regards JB > Le 23 déc. 2021 à 20:05, Jakub Herkel <jher...@gmail.com> a écrit : > > I tried to setup log4j2 via xml configuration but when I tried > "display" command I could see this exception: > org.apache.karaf.shell.impl.console.osgi.LoggingCommandSessionListener/org.apache.karaf.shell.impl.console.osgi.LoggingCommandSessionListener > [DEBUG] Executing command: 'display' > org.apache.felix.configadmin/org.apache.felix.cm.impl.Log [DEBUG] > getConfiguration(pid=org.ops4j.pax.logging, location=null) > org.apache.felix.configadmin/org.apache.felix.cm.impl.Log [DEBUG] > Found cached configuration org.ops4j.pax.logging bound to ? > org.apache.felix.configadmin/org.apache.felix.cm.impl.Log [DEBUG] > getConfiguration(pid=org.ops4j.pax.logging, location=null) > org.apache.felix.configadmin/org.apache.felix.cm.impl.Log [DEBUG] > Found cached configuration org.ops4j.pax.logging bound to ? > org.apache.karaf.shell.impl.console.osgi.LoggingCommandSessionListener/org.apache.karaf.shell.impl.console.osgi.LoggingCommandSessionListener > [DEBUG] Command: 'display' failed: java.lang.RuntimeException: Unable > to set level for logger > org.apache.karaf.shell.support.ShellUtil/org.apache.karaf.shell.support.ShellUtil > [ERROR] Exception caught while executing command > java.lang.RuntimeException: Unable to set level for logger > at > org.apache.karaf.log.core.internal.LogServiceLog4j2XmlImpl.setLevel(LogServiceLog4j2XmlImpl.java:139) > ~[?:?] > at > org.apache.karaf.log.core.internal.LogServiceImpl.setLevel(LogServiceImpl.java:106) > ~[?:?] > at org.apache.karaf.log.command.DisplayLog.execute(DisplayLog.java:74) > ~[?:?] > at > org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) > ~[?:?] > at > org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) > ~[?:?] > at > org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) > ~[?:?] > at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) > ~[?:?] > at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) > ~[?:?] > at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?] > at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?] > at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?] > at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?] > at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?] > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) > ~[?:?] > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) > ~[?:?] > at java.lang.Thread.run(Thread.java:833) [?:?] > Caused by: org.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is made > to reference a node in a context where it does not exist. > at > com.sun.org.apache.xerces.internal.dom.ParentNode.internalInsertBefore(ParentNode.java:364) > ~[?:?] > at > com.sun.org.apache.xerces.internal.dom.ParentNode.insertBefore(ParentNode.java:286) > ~[?:?] > at > org.apache.karaf.log.core.internal.LogServiceLog4j2XmlImpl.insertIndented(LogServiceLog4j2XmlImpl.java:168) > ~[?:?] > at > org.apache.karaf.log.core.internal.LogServiceLog4j2XmlImpl.setLevel(LogServiceLog4j2XmlImpl.java:121) > ~[?:?] > ... 15 more > Error executing command: Unable to set level for logger > > my org.ops4j.pax.logging.cfg contains: > org.ops4j.pax.logging.log4j2.config.file=${karaf.etc}/log4j2.xml > > and log4j2.xml: > <Configuration id="builtin.rolling"> > <Appenders> > <Console name="console"> > <PatternLayout pattern="%logger/%class [%level] %message%n" /> > </Console> > <RollingFile name="file" append="true"> > <fileName>logs/service.log</fileName> > <filePattern>logs/service.log.%d{yyyy-MM}</filePattern> > <PatternLayout pattern="%logger/%class [%level] %mdc %message%n" /> > <Policies> > <TimeBasedTriggeringPolicy /> > </Policies> > </RollingFile> > </Appenders> > > <Loggers> > <Logger name="my.logger" level="info" additivity="false"> > <AppenderRef ref="file" /> > </Logger> > <Root level="debug"> > <AppenderRef ref="console" /> > </Root> > </Loggers> > </Configuration> > > My environment is Fedora Linux F35 and openjdk 17.0.1. > > Could someone give me any hint what is wrong with this setup? > > best regards > > Jakub