捕获异常的日志文件,它来自哪里? [英] Log file that catch exceptions, where does it comes from?

查看:108
本文介绍了捕获异常的日志文件,它来自哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个可以捕获(我认为)所有异常的应用程序(c#).当应用运行时,有时会得到名为"date.log"的日志文件.文件具有类似的内容

I've made  an app(c#) that catches (i think) all the exceptions. When the app is running sometimes I get log files named "date.log". Files have something like this

[27  4 2011  12:22:48]   < 1492>捕获到异常!!!

[27  4 2011   12:22:48]  >>   <1492> Exception caught!!!

我是新手,所以我不知道这种正常"情况或如何避免这种情况,我也想知道如何找出引发异常的地方

I'm a newbie so I have no idea if this 'normal' or how could I avoid this, also I'd like to know how to find out where the exception was thrown

非常感谢!

推荐答案

你好Azucena.尝试在您的项目代码中搜索名为"date.log"的字符串.定义.另一方面,要捕获异常,您需要使用try-catch-finally块. 您可以在以下链接中找到更多信息:

Hello Azucena, if you are seeing those files, then your application is creating them. Try to search inside your project code where are a string named "date.log" defined. On the other hand, to catch exceptions you need to use the try-catch-finally blocks. You can find more information in the following link:

http://msdn.microsoft.com/en-us/library/0yd65esw(v = VS.100).aspx

希望这会有所帮助,

米格尔.


这篇关于捕获异常的日志文件,它来自哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆