另外我找到一个方案,可以不配置services文件也可以输入日志,但也会打印以下字样[11-11-15 11:20:05:649 CST] 00000016 SystemOut O 2011-11-15 11:20:05,649 [WebContainer : 0] INFO [org.syzone.demo.webservice.Test] - this a log...
显示全部另外我找到一个方案,可以不配置services文件也可以输入日志,但也会打印以下字样
[11-11-15 11:20:05:649 CST] 00000016 SystemOut O 2011-11-15 11:20:05,649 [WebContainer : 0] INFO [org.syzone.demo.webservice.Test] - this a log4j's send message
方案描述如下:
I found quite a simple solution for this problem, no shared library to add.
I found it after migrating one of my apps to WSFP (while on WAS 6.1, my JCL 1.1 problem was resolved with classloader on parent last,
I could not use anymore this solution with WSFP (see MikeC711 documentation dwWriteUp.doc).
I have filled a PMR, but no satisfying answer for the moment, hope IBM will publish an official solution for WSFP (you can also check for PMR 72352,122,000 as mentioned in the dwWriteUp.doc).
Anyway here is the solution (works for WAS 6.1, WSFP. Did not tested on WAS 7 but should work).
You will need to :
set application classLoader set to ParentLast.
download slf4j
http://www.slf4j.org/.remove commons-logging.jar from your application.
add slf4j-api-1.5.8.jar
add jcl-over-slf4j-1.5.8.jar
if you want to use log4j, add slf4j-log4j12-1.5.8.jar and of course log4j-.jar.
if you want to use another logging system just add the appropriate slf4j jar.
Now you application can continue using JCL APIs while in fact it is using SLF4J implementation which bridges to Log4J or whatever logging system you want.
原文地址:
https://www.ibm.com/developerworks/forums/thread.jspa?threadID=227753&start=0&tstart=0收起