如何在 Linux 的控制台上使用输出启动 Tomcat?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14010448/
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
How to start Tomcat with output on console in Linux?
提问by Igorock
I know it's possible to start tomcat and then run tail -f catalina.out
to view Tomcat output. But how to run tomcat and view output at once? Are there some options to run startup.sh
with?
我知道可以启动 tomcat 然后运行tail -f catalina.out
以查看 Tomcat 输出。但是如何同时运行 tomcat 并查看输出呢?是否有一些选项可以运行startup.sh
?
采纳答案by Olaf Kock
You're looking for
您正在寻找
tomcat/bin/catalina.sh run
instead of
代替
tomcat/bin/startup.sh; tail -f tomcat/logs/catalina.out
Tomcat stays in foreground this way (first option). If you want to shut it down, Ctrl-C in your console window will do the trick.
Tomcat 以这种方式保持在前台(第一个选项)。如果你想关闭它,控制台窗口中的 Ctrl-C 可以解决问题。
If you choose the second option, tomcat will run in background, while tail will run in foreground, but you'll have to give the same directory path twice.
如果选择第二个选项,tomcat 将在后台运行,而 tail 将在前台运行,但您必须两次提供相同的目录路径。
回答by vels4j
Instead of using service, cd
to Tomcat's bin directory, type ./startup.sh
. This will start Tomcat in console.
不用服务,cd
到Tomcat的bin目录下,输入./startup.sh
. 这将在控制台中启动 Tomcat。
All the logs that goes to catalina.out you can modify it by this link : Tomcat logging
转到 catalina.out 的所有日志您都可以通过此链接进行修改:Tomcat 日志记录