Windows 上的 Tomcat 控制台输出在哪里

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8362280/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 08:59:00  来源:igfitidea点击:

Where is Tomcat Console Output on Windows

windowstomcatlogging

提问by mkn

I used to start tomcat from its bin folder with the startup.bat. By running that script it opened a java window in which I can see the outputs from tomcat. However, I've been told that this is not the right way to start tomcat on a windows server. Therefore I start tomcat now over the service program. By doing so no java window is being opened anymore and therefore I can't see the output msg from tomcat.

我曾经使用startup.bat从其bin文件夹中启动tomcat。通过运行该脚本,它打开了一个 java 窗口,我可以在其中看到 tomcat 的输出。但是,有人告诉我这不是在 Windows 服务器上启动 tomcat 的正确方法。因此,我现在通过服务程序启动 tomcat。通过这样做,不再打开 Java 窗口,因此我看不到 tomcat 的输出消息。

I have also looked into the logs folder of tomcat. Those saved outputs are not the same as the one I had/have in java window. Does anyone know where I can find those outputs?

我还查看了 tomcat 的日志文件夹。那些保存的输出与我在 java 窗口中拥有/拥有的输出不同。有谁知道我在哪里可以找到这些输出?

Many thanks in advance for any advices.

非常感谢您提供任何建议。

采纳答案by Nikola Yovchev

If we assume your install is in C:\program files\apache software foundation\apache-tomcat{ver}\

如果我们假设您的安装位于 C:\program files\apache softwarefoundation\apache-tomcat{ver}\

then it is inside, in the log directory, in a file catalina.out.

然后它在日志目录中的文件 catalina.out 中。

C:\program files\apache software foundation\apache-tomcat{ver}\logs\catalina.out

C:\program files\apache softwarefoundation\apache-tomcat{ver}\logs\catalina.out

It's worth to note the name of the file depends on your configuration, also the name of the logs directory can be different depending on configuration but I assume you preserved default config.

值得注意的是文件的名称取决于您的配置,日志目录的名称也可能因配置而异,但我假设您保留了默认配置。

回答by Sunny Tambi

In Windows (I am using Windows 10) you should do these to check the running application's logs:-

在 Windows(我使用的是 Windows 10)中,您应该执行以下操作来检查正在运行的应用程序的日志:-

  1. Install Notepad++
  2. Open C:\Program Files\Apache Software Foundation\Tomcat {ver}\logs\tomcat{ver}-stdout.{date}.log in Notepad++
  3. Open View menu and enable 'Monitoring' in Notepad++
  1. 安装记事本++
  2. 在 Notepad++ 中打开 C:\Program Files\Apache Software Foundation\Tomcat {ver}\logs\tomcat{ver}-stdout.{date}.log
  3. 打开“查看”菜单并在 Notepad++ 中启用“监控”

回答by user3852017

There is no such thing. There is no catalina.out on MS Windows. On MS there is catalina-datetime-in-some-random-format.log but that is NOTcatalina.out nor does it contain same information.

哪有这回事。MS Windows 上没有 catalina.out。在 MS 上有 catalina-datetime-in-some-random-format.log 但这不是catalina.out 也不包含相同的信息。

On a real operating systems there is catalina.out that contains all output from JVM both stdout and stderr. On MS windoh! ;) it is just a log file for Tomcat JUL log file (not CONSOLE/stdout/stderr). Then there are catalina-stdout.log and catalina-stderr.log files. So every single time you need to find some information on M$ you have dig through all three files. Most of contain duplicate information making it absolute hell to try to process the logs via any automation like ELK stack.

在真正的操作系统上,catalina.out 包含来自 JVM 的所有输出,包括 stdout 和 stderr。在 MS windows 上!;) 它只是 Tomcat JUL 日志文件的日志文件(不是 CONSOLE/stdout/stderr)。然后是 catalina-stdout.log 和 catalina-stderr.log 文件。因此,每次您需要查找有关 M$ 的一些信息时,您都需要翻阅所有三个文件。大多数都包含重复的信息,这使得尝试通过任何自动化(如 ELK 堆栈)来处理日志是绝对的地狱。

回答by ziggy

Usually the logs should be in $TOMCAT_HOME/logs

通常日志应该在 $TOMCAT_HOME/logs

When running tomcat as a service, i have noticed that Tomcat sometimes generated logs in the folder where tomcat was started from so also check $TOMCAT_HOME/bin for any possible log files.

将 tomcat 作为服务运行时,我注意到 Tomcat 有时会在启动 tomcat 的文件夹中生成日志,因此还要检查 $TOMCAT_HOME/bin 以获取任何可能的日志文件。

This is why you should configure Log4j so that you have control of where the log files are created.

这就是为什么您应该配置 Log4j 以便您可以控制创建日志文件的位置。