Sounds like a good plan. At least for those log statements that the engine makes and that are not made in the classloading context of your application, logback.xml
in your application will not be useful I think. I just tried the following things myself and was able to get my logback configuration to work:
- Add logback-core and logback-classic jars to global lib folder
- Remove slf4j-jdk14
- Edit
${TOMCAT_HOME}/conf/catalina.properties
and add the following property:logback.configurationFile=<path to config>
and my logback config was used for all the engine’s log statements that use SLF4J.
In order to also redirect Tomcat’s internal logging, we would need to include jul-to-slf4j
(like you did) and then configure ${TOMCAT_HOME}/conf/logging.properties
to use the slf4j bridge handler as described in SLF4JBridgeHandler (SLF4J 2.0.1 API).