You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "xipki (via GitHub)" <gi...@apache.org> on 2026/02/24 08:57:20 UTC

[I] Switch the log backend from log4j2 to backend does not work [karaf]

xipki opened a new issue, #2291:
URL: https://github.com/apache/karaf/issues/2291

   I tried to switch the log backend from log4j2 to logback. I can start the karaf, but the log file data/log/karaf.log contains only very limited log entries (see below).
   
   ```
   Feb 24, 2026 9:49:24 AM org.apache.karaf.main.Main launch
   INFO: Installing and starting initial bundles
   Feb 24, 2026 9:49:24 AM org.apache.karaf.main.Main launch
   INFO: All initial bundles installed and set to start
   Feb 24, 2026 9:49:24 AM org.apache.karaf.main.lock.SimpleFileLock lock
   INFO: Trying to lock .../apache-karaf-minimal-4.4.9/lock
   Feb 24, 2026 9:49:24 AM org.apache.karaf.main.lock.SimpleFileLock lock
   INFO: Lock acquired
   Feb 24, 2026 9:49:24 AM org.apache.karaf.main.Main$KarafLockCallback lockAcquired
   INFO: Lock acquired. Setting startlevel to 100
   ```
   
   Steps to reproduce:
   
   1. In file `etc/org.apache.karaf.features.cfg`: change `framework` to `framework-logback`
   2. In file `etc/startup.propertie`: change `pax-logging-log4j2` to `pax-logging-logback`
   3. Start karaf: `bin/karaf`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@karaf.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Switch the log backend from log4j2 to backend does not work [karaf]

Posted by "xipki (via GitHub)" <gi...@apache.org>.
xipki commented on issue #2291:
URL: https://github.com/apache/karaf/issues/2291#issuecomment-3959044876

   Adding `org.ops4j.pax.logging.logback.config.file = ${karaf.etc}/logback.xml` to `etc/org.ops4j.logging.cfg` works. However the commands `log:*` cannot parse the log file.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@karaf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Switch the log backend from log4j2 to backend does not work [karaf]

Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on issue #2291:
URL: https://github.com/apache/karaf/issues/2291#issuecomment-3951357010

   @xipki ok, let me share a configuration with you. I will create a PR to include it by default in Karaf (as example).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@karaf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Switch the log backend from log4j2 to backend does not work [karaf]

Posted by "xipki (via GitHub)" <gi...@apache.org>.
xipki commented on issue #2291:
URL: https://github.com/apache/karaf/issues/2291#issuecomment-3951348925

   > [@xipki](https://github.com/xipki) can you check you have `org.ops4j.pax.logging.logback.config.file = /path/to/logback.xml` configuration ?
   
   I tried add `org.ops4j.pax.logging.logback.config.file = /path/to/logback.xml` in both `etc/system.properties` and `etc/custom.properties`, it did not help.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@karaf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Switch the log backend from log4j2 to backend does not work [karaf]

Posted by "xipki (via GitHub)" <gi...@apache.org>.
xipki commented on issue #2291:
URL: https://github.com/apache/karaf/issues/2291#issuecomment-3951158989

   I tried to creating a new file etc/logback.xml (see below), but with the same result as before. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@karaf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Switch the log backend from log4j2 to backend does not work [karaf]

Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on issue #2291:
URL: https://github.com/apache/karaf/issues/2291#issuecomment-3951233957

   @xipki can you check you have `org.ops4j.pax.logging.logback.config.file = /path/to/logback.xml` configuration ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@karaf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Switch the log backend from log4j2 to backend does not work [karaf]

Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on issue #2291:
URL: https://github.com/apache/karaf/issues/2291#issuecomment-3951216041

   @xipki JUL is already supported in Karaf via Pax Logging (as API).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@karaf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Switch the log backend from log4j2 to backend does not work [karaf]

Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on issue #2291:
URL: https://github.com/apache/karaf/issues/2291#issuecomment-3960713442

   @xipki yes, it's a known issue: some `log:*` commands assume log4j style configuration. I will create a separate issue specifically for that.
   
   I propose to keep this issue open to add `logback` example in the Karaf distribution.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@karaf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Switch the log backend from log4j2 to backend does not work [karaf]

Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on issue #2291:
URL: https://github.com/apache/karaf/issues/2291#issuecomment-3950535276

   You don't have a `etc/logback.xml` ?
   
   You can try this `etc/logback.xml`:
   
   ```
   <configuration debug="true">
   	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
   		<!-- encoders are by default assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
   		<encoder>
   			<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
   			</pattern>
   		</encoder>
   	</appender>
   
   	<root level="WARN">
   		<appender-ref ref="STDOUT" />
   	</root>
   
   	<logger name="osgi.log" level="WARN" />
   	<logger name="org.apache.camel" level="WARN" />
   	<logger name="org.ops4j" level="WARN" />
   	<logger name="org.eclipse.jetty" level="WARN" />
           <logger name="org.apache.karaf" level="INFO" />
   </configuration>
   ```
   
   Maybe we should provide a simple `etc/logback.xml` by default in the Karaf distribution ...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@karaf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Switch the log backend from log4j2 to backend does not work [karaf]

Posted by "grgrzybek (via GitHub)" <gi...@apache.org>.
grgrzybek commented on issue #2291:
URL: https://github.com/apache/karaf/issues/2291#issuecomment-3951207758

   there's no such thing as _backend JUL_...
   
   Pax Logging has two concepts - logging APIs/facades and logging backends.
   
   The APIs supported are exactly these:
   * SLF4J
   * Commons Logging
   * JULI logging (Tomcat JULI)
   * Avalon logging (ancient history)
   * JBoss logging
   * Log4j1 API
   * Log4j2 API
   * JUL (Java Util Logging)
   
   And there are only two backends (implementations):
   * Log4j2
   * Logback
   
   Originally, Pax Web had only one backend (implementation) - Log4j1, but after [Log4j Apocalypse fallout](https://en.wikipedia.org/wiki/Log4Shell) we've removed it (keeping only the API).
   
   the point is (with a lot of OSGi magic) that you can use _any_ API/facade with either of the two implementations - yes, even Log4j2 API with Logback backend.
   
   JUL API invocations are passed to any backend you choose (install) in OSGi runtime like Karaf.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@karaf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Switch the log backend from log4j2 to backend does not work [karaf]

Posted by "xipki (via GitHub)" <gi...@apache.org>.
xipki commented on issue #2291:
URL: https://github.com/apache/karaf/issues/2291#issuecomment-3951177188

   > Maybe we should provide a simple `etc/logback.xml` by default in the Karaf distribution ...
   
   Yes please, this helps a lot.
   
   BTW, could you also provide support of backend JUL (java util logging)?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@karaf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org