Tomcat 崩溃时生成的 hs_err_pid.log 文件是什么?

2022-01-12 00:00:00 jvm crash java tomcat

为了生成hs_err_pid.log 文件,是否需要在Tomcat 配置工具的Java 选项卡上进行任何特定设置?

Are any specific settings required on the Java tab of Tomcat configuration tool in order to generate a hs_err_pid.log file?

hs_err_pid.log 文件的默认位置是什么?这个位置可以更改吗?

What is the default location of the hs_err_pid.log file? Can this location be changed?

推荐答案

一个非常非常关于这个主题的好文档是 Java 故障排除指南 来自(最初)Sun.请参阅排除系统崩溃故障"一章.有关 hs_err_pid* 文件的信息.

A very very good document regarding this topic is Troubleshooting Guide for Java from (originally) Sun. See the chapter "Troubleshooting System Crashes" for information about hs_err_pid* Files.

请参阅 附录 C - 致命错误日志

根据指南,默认情况下,如果可能,文件将在进程的工作目录中创建,否则将在系统临时目录中创建.可以通过传入 -XX:ErrorFile 产品标志来选择特定位置.它说:

Per the guide, by default the file will be created in the working directory of the process if possible, or in the system temporary directory otherwise. A specific location can be chosen by passing in the -XX:ErrorFile product flag. It says:

如果未指定 -XX:ErrorFile= 文件标志,系统会尝试在进程的工作目录中创建文件.如果无法在工作目录中创建文件(空间不足、权限问题或其他问题),则在操作系统的临时目录中创建文件.

If the -XX:ErrorFile= file flag is not specified, the system attempts to create the file in the working directory of the process. In the event that the file cannot be created in the working directory (insufficient space, permission problem, or other issue), the file is created in the temporary directory for the operating system.

相关文章