使用log4j的Tomcat日志记录? [英] Tomcat Logging using log4j?

查看:129
本文介绍了使用log4j的Tomcat日志记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在系统中将Apache tomcat 5.5安装为服务.我也为Web应用程序添加了一个使用log4j的自定义日志文件.默认情况下,每当我在JSP页面中默认使用system.out.println("some text")语句时,它都会进入tomcat.logs目录中的stdout.log文件.我想要system.out.println("some text" )语句的输出要写入自定义日志文件而不是stdout.log文件中.

I have installed Apache tomcat 5.5 as a service in my system. Also i added a custom logging file using log4j for a web application. whenever i used system.out.println("some text") statement in my JSP page by default it goes to the stdout.log file which is in the logs directory of tomcat.i want system.out.println("some text") statement's output to be written in a custom log file rather than the stdout.log file is it possible.

推荐答案

作为服务启动时,可以从服务管理器配置stdout和stderr消息的文件位置.

When started as a service, you can configure the file locations for the stdout and stderr messages from the Service Manager.

尽管我同意@Brabster,但要移入生产环境时,应该使用log4j日志记录而不是System.out.

Though I agree with @Brabster, you should be using log4j logging instead of System.out when you want to move into production.

此链接包含屏幕截图和参考.请参见测试#2"

这篇关于使用log4j的Tomcat日志记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆