问题描述:
普通java工程,编译打包后,通过bat启动程序,出现如下错误:
log4j:ERROR setFile(null,true) call failed;/log/services.log (系统找不到指定的路径。)
分析过程:
1、在eclipse中运行正常。
2、修改发布环境的log4j.proporties中设置的log文件路径,报相同的错误,连路径都没变。
3、打印classpath,发现classpath中多出来一些无关的路径。
解决办法:
1、删除环境变量classpath
2、或者、将所有classpath下的log4j.properties找出来,只保留一个。
普通java工程,编译打包后,通过bat启动程序,出现如下错误:
log4j:ERROR setFile(null,true) call failed;/log/services.log (系统找不到指定的路径。)
分析过程:
1、在eclipse中运行正常。
2、修改发布环境的log4j.proporties中设置的log文件路径,报相同的错误,连路径都没变。
3、打印classpath,发现classpath中多出来一些无关的路径。
解决办法:
1、删除环境变量classpath
2、或者、将所有classpath下的log4j.properties找出来,只保留一个。
本文介绍了一种在使用log4j进行日志记录时遇到的路径错误问题,并提供了两种有效的解决方案:一是清理环境变量中的classpath;二是确保环境中只有一个log4j.properties文件。

被折叠的 条评论
为什么被折叠?



