如何设置jvm崩溃日志文件的位置
我需要配置创建 jvm 崩溃日志的位置。我喜欢它们的名称(hs_err_pid.log),但我希望它们在特定文件夹中创建。
在此处您可以看到可以使用 用于设置创建的 FILE 的参数
-XX:ErrorFile=./hs_err_pid<pid>.log
,但如果将其设置为文件夹,则使用原始命名约定在该文件夹中创建文件,它不起作用,它会被忽略。
我一直在通过从 这个问题 崩溃 jvm 1.6 来测试这一点,使用以下内容: PathDasher dasher = new PathDasher(null) ;
有人知道如何实现这一目标吗?
I need to configure where the jvm crash logs are created. I like the name they have (hs_err_pid.log) but I want them created in an specific folder.
In here you can see that you can use the
-XX:ErrorFile=./hs_err_pid<pid>.log
param to set the FILE created, but if you set this to a folder, so the file is created in that folder with the original naming convention, it does not work, it is ignored.
I have been testing this by crashing jvm 1.6 from this questions, using this:
PathDasher dasher = new PathDasher(null) ;
Anybody knows a way to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
-XX:ErrorFile=/var/log/java/hs_err_pid%p.log
有效。请参阅 http://www.oracle.com/technetwork/java/javase/ felog-138657.html
该参数不允许使用环境变量,但您可以在启动器脚本中使用环境变量(例如 .sh 或 .bat),操作系统将进行替换。但是,这将使用启动 JVM 时的环境变量值,而不是稍后写入文件时的值。此外,在 Eclipse 中设置“运行”属性时,环境变量不起作用。
JVM 不会创建保存故障转储的中间目录。如果指定的文件夹不存在,故障转储将保存在默认位置。
-XX:ErrorFile=/var/log/java/hs_err_pid%p.log
works.See http://www.oracle.com/technetwork/java/javase/felog-138657.html
The parameter does not allow for environment variables, but you can use environment variables in a launcher script (e.g. .sh or .bat) and the OS will do the substitution. However, this will use the value of the environment variable at the time of starting the JVM and not when the file is written later. Furthermore, environment variables do not work when setting Run properties in Eclipse.
The JVM will not create intermediate directories saving the crash dump. The crash dump will be saved at the default location if the specified folder does not exist.
你必须用它作为
。
在这里,Crash 是我的 java 文件。
You have to use this as
in command prompt.
Here, Crash is my java file.