title: log4j ContentAppender null when static
body: <p>When ConsoleAppender is static, I get the following error from log4j:</p>
  
  <pre><code>log4j:ERROR Attempted to append to closed appender named [null].
  </code></pre>
  
  <p>Example code:</p>
  
  <pre><code>import org.apache.log4j.ConsoleAppender;
  import org.apache.log4j.Logger;
  import org.apache.log4j.PatternLayout;
  public class Logging {
      private static final PatternLayout layout = new PatternLayout("[%d{dd MMM yyyy HH:mm:ss}] [%t] %-6r %-5p %m\n");
      private static final ConsoleAppender consoleAppender = new ConsoleAppender(layout);
      private Logger logger;
      private String filterClass;
      private boolean logFlag = false;
  
      public LoggingExample(Class c) {
          logger = Logger.getLogger(c);
          logger.setAdditivity(false);
          logger.removeAllAppenders();
          logger.addAppender(consoleAppender);
          consoleAppender.activateOptions();
          filterClass = c.getName();
      }
  
      public log() {
          logger.info("this doesn't work when ConsoleAppender is static!");
      }
  }
  </code></pre>