If you run with "-Dlog4j.debug" then log4j will print out info to standard output telling how it is trying to configure itself. Looking through that will tell you where it is looking for the config file.

In application servers like Tomcat you usually need to have both log4j.jar and the config file (log4j.properties or log4j.xml) at either the server level or app level. You should not have multiple log4j.jar files. If you want one config for all applications then you want log4j at the server level and you will want log4j.jar in common/lib and your config file in common/classes. If you want one config per application then you want log4j at the app level and you will want log4j.jar in WEB_INF/lib and your config file in WEB-INF/classes. There are issues with JBoss so it isn't quite that easy. You should not have log4j.jar at both the server and app level.

  • No labels