Tomcat 中未捕获的异常打印到 localhost.[date].log 而不是 catalina.out
我正在运行 tomcat 6.0.20(使用 spring,如果这很重要),并且似乎无法从代码中抛出的未捕获异常中获取堆栈跟踪以打印到 catalina.out。
我正在尝试模仿您在 eclipse 控制台中看到的输出。当我在生产服务器上部署战争并启动 tomcat 时,大部分输出都会转到 catalina.out,但我自己的代码中引发的异常的堆栈跟踪会转到 tomcat/logs/localhost.[date].log。
我怎样才能将所有相关日志记录到一个文件中(类似于 Eclipse 的控制台)?
我只需运行 tomcat/bin/startup.sh 即可启动服务器
I'm running tomcat 6.0.20 (with spring, if that matters) and can't seem to get stack traces from uncaught exceptions thrown from within my code to print to catalina.out.
I'm trying to mimic the output that you see in the eclipse console. When I deploy a war on a production server and start tomcat, most of the output goes to catalina.out, but stack traces from exceptions thrown within my own code goes to tomcat/logs/localhost.[date].log.
How can I get all of the relevant logging to go to one file (similar to eclipse's console)?
I'm starting the server by simply running tomcat/bin/startup.sh
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑 TOMCAT_HOME/conf/logging.properties 默认情况下,
catalina 引擎日志会记录到 catalina.log,本地主机日志记录到 localhost.log
,如下所示
选择并编辑
.prefix
指向您想要的那个。更新
catalina.out
在catalina.sh
启动脚本中显式引用,如下所示(但不在相应的 bat 文件中) - 这就是为什么我看不到 .out 文件在 Windows 上,但仅在 *nix 系统上"$CATALINA_BASE"/logs/catalina.out 2>&1
个人 我更喜欢将 Catalina 引擎日志与我的应用程序日志分开
Edit
TOMCAT_HOME/conf/logging.properties
The default would have the catalina engine log to catalina.log and the localhost logging to localhost.log
like below
Take your pick and edit
.prefix
to point to the one you want.Update
catalina.out
is explicitly referenced as shown below in thecatalina.sh
start script (but not in the corresponsing bat files) - which is why I dont see the .out file on windows but only on *nix systems"$CATALINA_BASE"/logs/catalina.out 2>&1
Personally I prefer the Catalina engine logs being separate from my application logs