开发者

Logging exceptions from windows service

I've implemented a windows service in C#. What is the best way to register the information regar开发者_Go百科ding exceptions that occurs in windows service? Using EventLoger class is a good idea? Or should I implements my own logger and write exception information to some text file.

Any help is appreciated.

Thank you.


Either use an exception logging/handling library like NBug, or a general purpose logging library like log4net or NLog (you'll need to create custom exception filters with NLog, if you use it).

If you do not want an additional .dll dependency, you're better of using internal System.Diagnostics.Trace & System.Diagnostics.Debug classes.


It depends. The two fundamental questions are: why are you logging the exception, and who will be reviewing the exceptions?

Depending upon the answer to those questions, you might not want to log exceptions at all, or you might want to send an email/sms message to someone to fix things pronto.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜