It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center




7年前关闭。





如何在log4j的帮助下将项目中正在运行的所有操作和异常获取到文件中。

最佳答案

1使用Logger机制将所有异常和错误记录到存储在硬盘驱动器或服务器位置(example : C:\\MyProject\logs\Mylog.txt中的文件中


我所说的Logger机制是Log4j的用法,它将有助于在单独的路径中记录应用程序中报告的所有异常。
Log4j.jar必须与其他相关的jar文件一起放置在lib文件夹中。


有用的链接:http://www.mkyong.com/struts/struts-log4j-integration-example/

关于java - Log4j属性和log4j.xml ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5091222/

10-15 13:18