简体   繁体   English

如何监视应用程序日志中的 Java 堆内存不足错误?

[英]How to monitor applications log for java heap out of memory error?

I want to monitor my application's log file (running on Linux Tomcat) and alert the developer(via email) when a "java heap space - out of memory error" appears in logs.我想监视我的应用程序的日志文件(在 Linux Tomcat 上运行)并在日志中出现“java 堆空间 - 内存不足错误”时提醒开发人员(通过电子邮件)。 Are there any solutions out there?有什么解决方案吗?

If scanning the logs is not a requirement, JMX can be an alternative to that.如果不需要扫描日志,JMX 可以作为替代方案。 Check this answer on how to programmatically access JVM JMX metrics. 检查有关如何以编程方式访问 JVM JMX 指标的答案 The next step is to implement some code that will periodically probe your MBean and send an email to you (something along these lines this ) in case heap memory crosses a given threshold.下一步是执行一些代码,将定期探讨您的MBean并发送电子邮件给你(东西沿着这些路线情况下堆内存)越过定阈值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM