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.6.jar and slf4j-simple-1.5.6.jar in ./lib
  4. remove log4j-1.2.14.jar from the eclipse buildpath
  5. remove commons-logging-api.jar from lib
  6. add the slf4j-api-1.5.6.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. remove all occurrences of PropertyConfigurator.configure(props) (mostly in tests) ==> move log4j properties from jspwiki.properties to separate log4j.properties ./classes directory
  10. NDC => MDC , these are only in the two ServletFilters,
  11. a strange log4j config manipulation in ProviderConverter (leaving untouched):
        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

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)

WebSphere#

Initially we assumed that JSPWiki did not run "out of the box" on WebSphere. Well, this is not true anymore for WebSphere 6.1 upwards.
Up until WebSphere 6.0 the commons-logging-api.jar is shipped by default in the WebSphere lib directory, which is the root cause of the problem. For full details , see http://www-01.ibm.com/support/docview.wss?uid=swg27004610&aid=1
I just tested this morning a standard (log4j based) JSPWiki on WebSphere 6.1, and it runs fine without special tweaks to either JSPWiki or WebSphere (after pointing the pages and attachments directory to /tmp)

Find & Replace
×