You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Apache Log4j 2 is an upgrade to Log4j that provides significant improvements over its predecessor, Log4j 1.x, and provides many of the improvements available in Logback while fixing some inherent problems in Logback's architecture.

Information

Problems

  1. New package
    • org.apache.log4j changed to org.apache.logging.log4j

    • We may need to change in a bunch of modules when we try to convert to the new package


  2. DOM and Property Configurator was removed
  3. Log4J 2 over the old fashioned properties file is supported so far
  4. API for setLevel / getEffectiveLevel - http://apache-logging.6191.n7.nabble.com/API-and-setLevel-getEffectiveLevel-td36238.html
  5. Unit-testing
    1. Customer Appender

      Writer loggerOut = new StringWriter();
      final Layout layout = new EnhancedPatternLayout(EnhancedPatternLayout.TTCC_CONVERSION_PATTERN);
      Logger.getRootLogger().setLevel(Level.INFO); // Other tests might have set this to silent
      Logger.getRootLogger().addAppender(new WriterAppender(layout, loggerOut));

       



 

Code Snippets

 

 

 

  • No labels