Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am creating a Logging Mechanism for a standard application run.
I want to filter my logs into two different categories, in order to control the logging.
Categories are :
1.Exceptions
2.Debug events.
Is there any property which can differentiate between the two events?
Posted
Updated 25-May-14 20:05pm
v3

1 solution

You can use the enumeration System.Diagnostics.EventLogEntryType:
http://msdn.microsoft.com/en-us/library/vstudio/system.diagnostics.eventlogentrytype[^].

This is one of the methods using this type: http://msdn.microsoft.com/en-us/library/vstudio/f6wy11we[^].

Besides, you can have several different "event sources" and introduce any arbitrary classification based on that: http://msdn.microsoft.com/en-us/library/vstudio/2awhba7a[^].

But, looking at your purpose, it would be even more useful to isolate some branches on the event log tree shown by the standard system event viewer to show events specific to your applications separately from other events. Unfortunately, this method will require some uninstallation, to clean up the target system when this is no longer needed. If you are going to deploy your product with logging enables with the use of installer, it won't be a problem, if not, you would need to take care about such clean up separately. Please see my past answer:
How to create event log under a folder[^].

—SA
 
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