I’m developing a web application using Logback as logging framework, and am testing it in Tomcat 6. For some reason, logback.xml does not get read.
- logback.xml is in WEB-INF/classes.
- Logback itself is in WEB-INF/lib.
- I’m using SLF4J.
- Logback is used: I see log messages in catalina.out, and
LoggerFactory.getLogger(...)returns logback logger instances. - I’ve already reloaded the app and even restarted Tomcat.
Any idea what’s going on?
Update: It appears something deeper is going on. These return null:
// in a servlet
getClass().getClassLoader().getResource("/logback.xml");
getClass().getClassLoader().getResource("MyServlet.class");
When I log the classloader, everything appears fine:
22:32:11.221 [http-8080-1] INFO test.MyServlet - WebappClassLoader
context: /test
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@630f41e9
It was a Linux permission thing. Some directory lacked read/execute permissions. I accidentally fixed it when I ran into more problems with that.