[英]Tomcat console log to a file
Im using Apache Tomcat 7 . 我正在使用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. 当我使用安全管理器运行Tomcat并使用-Djava.security.debug
参数时,我在控制台中获得了大量文本。 I can't read the text in console. 我无法在控制台中阅读文本。 So I need the console log into some file . 所以我需要将控制台登录到某个文件中 。 How can I achieve this? 我怎样才能做到这一点?
Remove ConsoleHandler
from logging configuration. 从日志记录配置中删除ConsoleHandler
。 In conf/logging.properties
: 在conf/logging.properties
:
Change this - 改变这个 -
.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
To this - 对此 -
.handlers = 1catalina.org.apache.juli.FileHandler
The logs will be in the file catalina.log
. 日志将在catalina.log
文件中。
If you want to disable console logging for selected applications, you can set swallowOutput
in true in the <Context>
element. 如果要禁用所选应用程序的控制台日志记录,可以在<Context>
元素中将swallowOutput
设置为true。
...
<Context path="..." swallowOutput="true">
...
使用catalina.bat
运行可以在当前控制台而不是新控制台中启动tomcat,因此您可以使用此命令的所有标准错误和标准输出流重定向到文件
catalina.bat run > tomcat.log
for ubuntu user, use following command: 对于ubuntu用户,请使用以下命令:
you will get the logs. 你会得到日志。 Once you run this command you will get all the log files under /opt/apache-tomcat-8.0.36/logs folder.. 运行此命令后,您将获得/opt/apache-tomcat-8.0.36/logs文件夹下的所有日志文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.