Is there any easy way to auto write all the unhandled exception in my application to a log file?
I`m using log4net as my logging solution.
My application hosted as a windows service.
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It depends on the type of application you are running. You should always register the
AppDomain.UnhandledExceptionevent during startup of your application:When using a ASP.NET application, you can hook onto the
HttpApplication.Errorevent use the Global.asax to do this. When using a Windows Forms application you can hook onto theApplication.ThreadExceptionevent.