So we have our J2EE application using Log4j like this
public class CustomerController
{
private static Logger logger = Logger.getLogger(CustomerController.class);
public CustomerService customerservice = null;
public CustomerController() throws Exception
{
PropertyConfigurator.configureAndWatch("c:\log4j.property", 50000);
customerservice = ServiceManagerSingleton.getCustomerServiceInstance();
}
}
This way we can change the log-level realtime. Very handy. Most of our classes are set up just like this controller. We use the singleton-pattern so that we only have one instance of eash class; one call to PropertyConfigurator.configureAndWatch() for each class, once.
The problem: About twice a week our appserver dies and creates a heapdump. Using Heap Analyzer from IBM we can see that there seems to be alot of threads related to Log4j:
808 (0%) [200] 9 org/apache/log4j/PropertyWatchdog 0x14282ad8
About 30,000 in total. So this is probably the reason for the sudden crash.
- Are we setting this up correctly?
- What happens to all those threads when the EAR is redeployed?