!! SLF4J , Simple Logging Facade for Java
[website|http://www.slf4j.org/]
[JIRA issue 376|https://issues.apache.org/jira/browse/JSPWIKI-376]
!! Steps
# run the [slf4j migrator|http://www.slf4j.org/migrator.html] ==> migrates only java sources (not jsp's)
# allmost all JSP's have to be manually adjusted
# add slf4j-api-1.5.6.jar and slf4j-simple-1.5.6.jar in ./lib
# remove log4j-1.2.14.jar from the eclipse buildpath
# remove commons-logging-api.jar from lib
# add the slf4j-api-1.5.6.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())''
# remove all occurrences of ''PropertyConfigurator.configure(props)'' (mostly in tests) ==> move log4j properties from jspwiki.properties to separate log4j.properties ./classes directory
# NDC => MDC , these are only in the two ServletFilters,
# 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" );
}}}
# run the tests and the web-tests
# 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)