SLF4J , Simple Logging Facade for Java#

website JIRA issue 376

Steps#

  1. run the slf4j migrator ==> migrates only java sources (not jsp's)
  2. allmost all JSP's have to be manually adjusted
  3. add slf4j-api-1.5.3.jar and slf4j-simple-1.5.3.jar in ./lib
  4. remove log4j-1.2.14.jar from ./lib and from the eclipse buildpath
  5. mind that commons-logging-api.jar is still needed by oscache !
  6. add the slf4j-api-1.5.3.jar to the eclipse buildpath
  7. src change: log.fatal( ==> log.error(
  8. src change: slf4j log methods only accept Strings, so log.error(Exception) ==> log.error(Exception.toString())
  9. PropertyConfigurator.configure(props) all over the place (mostly in tests) ==> move log4j properties from jspwiki.properties to separate log4j.properties (in classpath) ?
  10. NDC => MDC ?, these are only in the two ServletFilters, if we still need them, what will we use as key (cookie ?)
  11. a strange log4j config in ProviderConverter:
        props.setProperty( "log4j.appender.outlog", "org.apache.log4j.ConsoleAppender" );
        props.setProperty( "log4j.appender.outlog.layout", "org.apache.log4j.PatternLayout" );
        props.setProperty( "jspwiki.useLucene", "false" );
        props.setProperty( "log4j.rootCategory", "INFO,outlog" );
  1. run the tests and the web-tests
  2. test with tomcat
  3. test with WebSphere (old JSPWiki version and new (slf4j) JSPWiki version

Findings#

  • non-core plugins also need adjustments, an example:
SEVERE: Exception starting filter WikiJSPFilter
java.lang.NoClassDefFoundError: org/apache/log4j/Logger
	at org.goodjava.plugin.hitcounter.HitCounter.<clinit>(Unknown Source)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:186)