Search code examples
javalogbacklog4j2embedded-jettylogback-groovy

Can't see logback logs in log4j configured embeded Jetty application


In my java application I have embedded a jetty and I'm using log4j2 for my logging. When I deploy war files which use log4j2 as its logging mechanism I can see logs. But problem arise when I deploy war files which use logback as logging mechanism, because I can't get logs.


Solution

  • Please take a look at which jars you need:

    If you add the log4j-slf4j-impl-2.7.jar and remove the logback jars then all Logback logging will be included in the Log4j 2 log.

    I assume you already have the slf4j-api jar in the classpath. Keep that, but replace the Logback jars with the log4j-slf4j-impl-2.7.jar.