I am running Spring through tomcat and using Log4j. I have recently added a spring bean to handle a graceful shutdown of the Spring Integration components.
This all works fine but my logging output in my destroy method is lost - I assume this is because log4j has already been terminated. I can see output by using System.out.
My bean's destroy method is called from the spring config "destroy-method" The logging inside the bean is via:
private final static Logger LOGGER = Logger.getLogger(Monitor.class.getName());
...
LOGGER.info("Application shutdown started");
I have log4j on the classpath (which is the only way Spring is aware of it) and a log4j.properties file.
I am thinking because my bean does not directly rely on log4j, Spring is terminating it before my destroy() method.
Does anybody know of some way to make Spring hold onto log4j until I have finished my destroy()?