SLF4J , Simple Logging Facade for Java#
Steps#
- run the slf4j migrator
- allmost all JSP's have to be adjusted
- add the slf4j-api.jar to the eclipse buildpath
- add slf4j-api-1.5.3.jar and slf4j-simple-1.5.3.jar in ./lib
- 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 ?)
- change build.xml so that slf4j-api.jar is added to WEB-INF/lib
- 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)
