Click here to Skip to main content
15,914,071 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
is there any way to write error in Event viewer using web config file.
i can write error using
System.Diagnostics.EventLog.WriteEntry("CustomEventLog", "Message"");

but i dont want to write code in each page. so is ther any way to make it in web config file or global app file.
Thanks
Posted
Updated 24-Jun-15 22:36pm
v2

1 solution

Well the best way to do what you want is to use a third party logging library like Log4Net. These libraries are smart enough to log in Files, database, event viewers, etc.

For hints use below links.

log4net multiple appenders, writing to event viewer[^]

Windows Event Viewer and log4net[^]
 
Share this answer
 
Comments
kapil0411 25-Jun-15 4:33am    
Thanks for you reply but i dont want to use any third party dll's.

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