Java 不登录 catalina.out
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3424515/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Not to log to catalina.out
提问by tzulberti
I have the following logging.properties configuration:
我有以下 logging.properties 配置:
1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = /mnt/asd/tomcat_logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.
2localhost.org.apache.juli.FileHandler.level = FINE
2localhost.org.apache.juli.FileHandler.directory = /mnt/asd/tomcat_logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.
3manager.org.apache.juli.FileHandler.level = FINE
3manager.org.apache.juli.FileHandler.directory = /mnt/asd/tomcat_logs
3manager.org.apache.juli.FileHandler.prefix = manager.
4host-manager.org.apache.juli.FileHandler.level = FINE
4host-manager.org.apache.juli.FileHandler.directory = /mnt/asd/tomcat_logs
4host-manager.org.apache.juli.FileHandler.prefix = host-manager.
In the folder /mnt/asd/tomcat_logs there are the following files:
在文件夹 /mnt/asd/tomcat_logs 中有以下文件:
- catalina.2010-08-06.log
- host-manager.2010-08-06.log
- localhost.2010-08-06.log
- manager.2010-08-06.log
- catalina.2010-08-06.log
- 主机管理器.2010-08-06.log
- 本地主机.2010-08-06.log
- manager.2010-08-06.log
But in the /etc/tomcat/tomcat/logfolder there is also catalina.outfile. How can I change the path of the file to /mnt/asd/tomcat_logs??
但是在/etc/tomcat/tomcat/log文件夹中还有catalina.out文件。如何将文件路径更改为 /mnt/asd/tomcat_logs??
回答by tzulberti
回答by Kobra Ghahremani
you must edit "$CATALINA_BASE"/bin/catalina.sh file and find CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out and replace with new path .
您必须编辑 "$CATALINA_BASE"/bin/catalina.sh 文件并找到 CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out 并替换为新路径。
restart tomcta and enjoy it .
重新启动 tomcta 并享受它。
回答by David Vít
Above approaches are correct, but rather than changing existing sh files, please create new "$CATALINA_BASE/bin/setenv.sh" file and add this entry:
以上方法是正确的,但不要更改现有的 sh 文件,请创建新的“$CATALINA_BASE/bin/setenv.sh”文件并添加以下条目:
export CATALINA_OUT="/new/path/to/catalina.out"
export CATALINA_OUT="/new/path/to/catalina.out"
Do not forget to chmod +x "$CATALINA_BASE/bin/setenv.sh".
不要忘记 chmod +x "$CATALINA_BASE/bin/setenv.sh"。
For Windows use its setenv.bat counterpart.
对于 Windows,使用它的 setenv.bat 对应物。
回答by Monkiki
Edit conf/logging.propertiesand change:
编辑conf/logging.properties并更改:
.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
By
经过
.handlers = 1catalina.org.apache.juli.FileHandler
回答by Rbkpro Dev
You might be overriding the logging.properties file somewhere, So you must check for :
您可能在某处覆盖了 logging.properties 文件,因此您必须检查:
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
1catalina.org.apache.juli.AsyncFileHandler.level = FINE
1catalina.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.
2localhost.org.apache.juli.AsyncFileHandler.level = FINE
2localhost.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.
3manager.org.apache.juli.AsyncFileHandler.level = FINE
3manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
3manager.org.apache.juli.AsyncFileHandler.prefix = manager.
4host-manager.org.apache.juli.AsyncFileHandler.level = FINE
4host-manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter