SLF4J , Simple Logging Facade for Java#
Steps#
- run the slf4j migrator
==> migrates only java sources (not jsp's)
- allmost all JSP's have to be manually adjusted
- add slf4j-api-1.5.3.jar and slf4j-simple-1.5.3.jar in ./lib
- remove log4j-1.2.14.jar from ./lib and from the eclipse buildpath
- mind that commons-logging-api.jar is still needed by oscache !
- add the slf4j-api-1.5.3.jar to the eclipse buildpath
- src change: log.fatal( ==> log.error(
- src change: slf4j log methods only accept Strings, so log.error(Exception) ==> log.error(Exception.toString())
- PropertyConfigurator.configure(props) all over the place (mostly in tests) ==> move log4j properties from jspwiki.properties to separate log4j.properties (in classpath) ?
- NDC => MDC ?, these are only in the two ServletFilters, if we still need them, what will we use as key (cookie ?)
- 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" );
- run the tests and the web-tests
- test with tomcat
- 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)
