Tomcat控制台登录到文件 [英] Tomcat console log to a file
问题描述
我正在使用 Apache Tomcat 7 。当我使用安全管理器运行Tomcat并使用 -Djava.security.debug
参数时,我在控制台中获得了大量文本。我无法在控制台中阅读文本。所以我需要控制台登录到某个文件。我怎样才能实现这个目标?
Im using Apache Tomcat 7. When I'm running Tomcat with security manager and with the -Djava.security.debug
parameter I'm getting so much of text in console. I can't read the text in console. So I need the console log into some file. How can I achieve this?
推荐答案
从日志记录配置中删除 ConsoleHandler
。在 conf / logging.properties
:
Remove ConsoleHandler
from logging configuration. In conf/logging.properties
:
更改此项 -
.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
到此 -
.handlers = 1catalina.org.apache.juli.FileHandler
日志将在文件中 catalina.log
。
如果要禁用所选应用程序的控制台日志记录,可以设置 swallowOutput
在< Context>
元素中为true。
If you want to disable console logging for selected applications, you can set swallowOutput
in true in the <Context>
element.
...
<Context path="..." swallowOutput="true">
...
这篇关于Tomcat控制台登录到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!