How to log all thrown exceptions?

2019-01-09 08:54发布

How to log any exceptions that were thrown and catched? Something like Visual Studio's IntelliTrace do. Or is there a way to integrate InteliTrace into debug version of application and then view its logs?

Update: I'll clarify that a bit. I want standard .txt (or any custom) logs, the format doesn't matter. The main point is I want to log all exceptions that occurred in all third-party libraries without adding code to them.

8条回答
做个烂人
2楼-- · 2019-01-09 09:37

You could attach a debugger, like WinDbg, to your process, and get it to break on any first chance CLR exceptions; this will include exceptions in the third party library. See here for an example of how to do this.

查看更多
Root(大扎)
3楼-- · 2019-01-09 09:37

try using Log4Net - its a great logger and used a lot in these scenarios http://sourceforge.net/projects/log4net/

查看更多
登录 后发表回答