« | September 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | | | | | |
| 公告 |
戒除浮躁,读好书,交益友 |
Blog信息 |
blog名称:邢红瑞的blog 日志总数:523 评论数量:1142 留言数量:0 访问次数:9708009 建立时间:2004年12月20日 |

| |
[java语言]commons-logging结合Log4j的问题 原创空间, 软件技术
邢红瑞 发表于 2005/8/23 17:56:01 |
最近诸事不顺,升级Commons Logging居然出了问题,把Commons Logging升级到1.0.4,启动服务器出现了
java.lang.NoSuchMethodError: org.apache.log4j.Category.log(Ljava/lang/String;Lorg/apache/log4j/Level;Ljava/lang/Object;Ljava/lang/Throwable;)V at org.apache.commons.logging.impl.Log4JCategoryLog.debug(Log4JCategoryLog.java:94)
认为是log4j的问题 ,把log4j升级到1.2.9,还是不行,升级到1.2.11,错误依旧,只好看源码了,Log4JCategoryLog.java中,有这末一句,"deprecated Use {@link Log4JLogger} instead",原来是class目录下commons-logging.properties的问题
原来的commons-logging.properties
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLog
更改后的commons-logging.properties
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
class目录下log4j..properties文件配置信息
# For JBoss: Avoid to setup Log4J outside $JBOSS_HOME/server/default/deploy/log4j.xml!# For all other servers: Comment out the Log4J listener in web.xml to activate Log4J.#log4j.rootLogger=INFO, stdout, logfilelog4j.rootLogger=INFO,stdout,logfile
log4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layout=org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
log4j.appender.logfile=org.apache.log4j.RollingFileAppenderlog4j.appender.logfile.File=${tatan.root}/log/ebook.loglog4j.appender.logfile.MaxFileSize=512KB# Keep three backup files.log4j.appender.logfile.MaxBackupIndex=0# Pattern to output: date priority [category] - messagelog4j.appender.logfile.layout=org.apache.log4j.PatternLayoutlog4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n
# If programmed properly the most messages would be at DEBUG # and the least at FATAL.
log4j.logger.com.tatan.dao.jdbc=DEBUGlog4j.logger.com.tatan.service.impl=DEBUG
注意不要多写stdout,log4j.logger.com.tatan.Myclass=DEBUG, stdout,它会会继承root的appender ,会重复输出了
webapproot的配置 <context-param> <param-name>webAppRootKey</param-name> <param-value>ebook.root</param-value> </context-param> |
|
回复:commons-logging结合Log4j的问题 原创空间, 软件技术
sunfy(游客)发表评论于2006/9/13 10:27:24 |
thanx so much.i got puzzled for long time and solved the problem with the hepl of ur post. |
|
回复:commons-logging结合Log4j的问题 原创空间, 软件技术
asfd(游客)发表评论于2006/6/10 16:48:22 |
|
回复:commons-logging结合Log4j的问题 原创空间, 软件技术
jamjar(游客)发表评论于2006/5/11 8:57:38 |
|
回复:commons-logging结合Log4j的问题 原创空间, 软件技术
oldreams(游客)发表评论于2006/4/13 14:55:54 |
|
回复:commons-logging结合Log4j的问题 原创空间, 软件技术
haha(游客)发表评论于2006/3/17 14:54:10 |
|
回复:commons-logging结合Log4j的问题 原创空间, 软件技术
joseph牛牛(游客)发表评论于2005/12/9 14:43:23 |
|
回复:commons-logging结合Log4j的问题 原创空间, 软件技术
aq(游客)发表评论于2005/11/21 10:46:38 |
|
回复:commons-logging结合Log4j的问题 原创空间, 软件技术
yunchat(游客)发表评论于2005/8/26 17:13:23 |
好, 我还在奇怪新下载的commons-longging 包下杂没了Log4JCategoryLog这类呢 |
|
» 1 »
|