简体   繁体   English

记录致命的崩溃

[英]Logging of fatal crashes

How I can make a log of a fatal crash somewhere in my application without using try-cache for the whole program. 我如何在应用程序中某处记录致命崩溃的日志,而不用对整个程序使用try-cache。 In my case it is even impossible because I have an RCP application. 就我而言,这甚至是不可能的,因为我有一个RCP应用程序。 Where I don't control the start and the end point of it. 我无法控制起点和终点的地方。 How I can do the same but only fro one thread? 我如何才能执行相同的操作,但只能执行一个线程? Another question in my application I use Spring how I can send spring logging stream to my log? 我使用Spring的应用程序中的另一个问题是如何将Spring日志流发送到日志中? I use log4j. 我使用log4j。

One option might be playing with Thread.setUncaughtExceptionHandler() . 一种选择可能是使用Thread.setUncaughtExceptionHandler() But that would work best if you have some control over how the threads are created, or at least a known entry point, so you can set the handler. 但是,如果您可以控制线程的创建方式或至少有一个已知的入口点,那将是最好的选择,因此您可以设置处理程序。 It also assumes no code in the thread's call stack is catching exceptions and doing something with them. 它还假定线程的调用堆栈中没有代码捕获异常并对其进行处理。

Otherwise, can't really suggest anything else without knowing more about how the app works. 否则,在不了解应用程序如何工作的情况下,无法真正提出其他建议。

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

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