Click here to Skip to main content
15,790,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi I have one console application, in that if i got any error so simply used Console.Write("error message ") which shows message on console screen.
But now , i want to do , log report
whenever any error generated by application , i have to get mail on my id , with error message.
like in web application , we can write in Application_Error() of Global.asax file.
Do reply.
Thank you.

Console application or not, does not matter. You have a log mechanism which always works, event for Windows Services (which are much more difficult to debug then other applications):
This one is from .NET BCL:[^].

And this is the open-source alternative: Apache log4net:[^],[^],[^].

This CodeProject article can also be useful: log4net Tutorial[^].

Share this answer
You can use log4net. log4net Tutorial[^]
Share this answer
i used but it was not working.
but thankx for response.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900