title: LOG4J as singleton, closing appenders on server stop and start (Attempted to append to closed appender)
body: <p>We have a j2ee web environment. The server is configured to share session and possibly classloaders across multiple webapps. Basically, one classloader could server multiple web apps.</p>
  
  <p>This seems to cause issues with log4j. Different webapps could have different log4j configurations but the logging may stop in one file.</p>
  
  <p>We get the following error:</p>
  
  <p>log4j:ERROR Attempted to append to closed appender named [mylogger]</p>
  
  <p>Server: websphere6+
  Log4j: 1.4.2
  Java: 1.5</p>
  
  <pre><code>Example log4j.properties (webapp1):
  
  log4j.appender.R=org.apache.log4j.RollingFileAppender
  log4j.appender.R.File=/usr/local/file1.log
  log4j.additivity.com.app=false
  
  Example log4j.properties (webapp2):
  
  log4j.appender.Z=org.apache.log4j.RollingFileAppender
  log4j.appender.Z.File=/usr/local/file2.log
  log4j.additivity.com.app=false
  </code></pre>
  
  <p>Right now, logging from webapp2 may appear in the webapp1 logs and vice verse. We don't want that.</p>