互联网服务WebSphere中间件

websphere的LOG4J配置?

我工程里LOG4J的配置
在src根目录下 log4j.properties
里的配置内容如下
---------------------------------------
log4j.rootCategory=info,A1
log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A1.File=D:/log/sysinfo.log
log4j.appender.A1.DatePattern='.'yyyy-MM-dd
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
------------------------------------------------------------
在TOMCAT的服务器下好用,打包放到WEBSPHERE下,就没有不好用了?,输出都打印到SystemOut.log里了
大家给点意见?为啥

附件:

附件图标services.rar (190 Bytes)

参与24

24同行回答

newvirusnewvirus软件开发工程师普天信息技术有限公司
学习了 高人真不少显示全部
学习了 高人真不少收起
互联网服务 · 2012-02-17
浏览999
laopoainibenlaopoainiben软件实施顾问ibm
正好用到了显示全部
正好用到了收起
银行 · 2012-02-05
浏览1034
hace1983hace1983软件开发工程师亚信联创
了解一下显示全部
了解一下收起
互联网服务 · 2011-12-24
浏览991
maxidmaxid技术经理宜通
另外我找到一个方案,可以不配置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收起
电信设备制造商 · 2011-11-15
浏览1116
maxidmaxid技术经理宜通
请问这个META-INF/services是EAR项目下的吗?显示全部
请问这个META-INF/services是EAR项目下的吗?收起
电信设备制造商 · 2011-11-15
浏览1035
btshanghaibbtshanghaib开发工程师柯华
正好项目中遇到这个问题,参考一下。显示全部
正好项目中遇到这个问题,参考一下。收起
IT分销/经销 · 2011-11-07
浏览1002
zhuyl_windzhuyl_wind其它ncs
hen hao!!!!!!!显示全部
hen hao!!!!!!!收起
IT分销/经销 · 2011-05-26
浏览988
lighterskylightersky系统工程师ytec
thx a lot!显示全部
thx a lot!收起
机械装备 · 2011-04-26
浏览992
学习了了显示全部
学习了了收起
2010-03-29
浏览979
学习了了显示全部
学习了了收起
2010-03-29
浏览995

提问者

zhiy66
系统工程师北京微电子技术研究所
擅长领域: 中间件portaljava

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2008-12-19
  • 关注会员:0 人
  • 问题浏览:18574
  • 最近回答:2012-02-17
  • X社区推广