title: How do I properly Log4j, closing all Appenders and, therefore, files
body: <p>My servlet-based web-app sometimes fails to close Log4j log files when redeployed, leaking to file descriptor leakage and occassionally leading to servlet-contained dying from 'too many open files'.</p>
  
  <p>I have a ContextListener, what should I put into its contextDestroyed() to tell log4j to shut down and release all resources?</p>
  
  <p>Quick skim over javadocs revealed Hierachery class with shutdown() method. I have no idea on how to actually get the current Hierachery, and the javadoc states this class has no user-serviceable components inside :)</p>