Reloading Log4j Configuration in Tomcat

When you’re in production environment and you want to diagnose some problems, it’s often handy to have some more logging available. So, when you’re using Log4j, and you want to have your log4j.xml reloaded, you can use Log4jWebConfigurer to make this happen.

To use it, you need to add a listener your web.xml. Be careful to place this before the ContextLoaderListener entry. Also important is to add a log4jRefreshInterval (in milliseconds), else Log4j won’t start it’s deamon thread.


This should reload your log4j.xml changes whenever they occur.