Logback stops working when upgrading to Tomcat 10.1

588 Views Asked by At

I have a war (built with Java 8) that's using Logback. This is working well in Tomcat 9.0.* but now I want to deploy it on Tomcat 10.1 and the logging from my app is not working. I can see Tomcat's log messages from java.util.logging, like org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory, but nothing from my app.

My dependencies are:

  • ch.qos.logback:logback-classic:jar:1.2.11
  • ch.qos.logback:logback-core:jar:1.2.11
  • org.slf4j:slf4j-api:jar:1.7.36
  • org.slf4j:jcl-over-slf4j:1.7.36

Setting <configuration debug="true" in my logback.xml didn't produce anything, and neither did setting logback.configurationFile parameter manually.

How can I debug this? Maybe enabling a particular logger in Tomcat?

I know there are other problems in my app (javax - jakarta issue), I don't think they would cause this logback issue... without logging it will be hard to fix the other issues.

Edit: The Tomcat starts well with Java 11, just my war is built with Java 8 and the war seems to deploy successfully.

1

There are 1 best solutions below

0
stacky On

In the tomcat documentation for vers 10.1.X :

Applications that run on Tomcat 9 and earlier will not run on Tomcat 10 without changes. Java EE based applications designed for Tomcat 9 and earlier may be placed in the $CATALINA_BASE/webapps-javaee directory and Tomcat will automatically convert them to Jakarta EE and copy them to the webapps directory. This conversion is performed using the Apache Tomcat migration tool for Jakarta EE tool which is also available as a separate download for off-line use. https://tomcat.apache.org/

I think deploying the war to the webapps-javaee directory instead of the webapps directory will solve your problem