Error logging for application
-
Hi all, In my project we had system to log the exceptions through creating a text file for each day and writing the exceptions occured during tht day. The exceptions will be cathed through exception handling applied for necessary events. There is system class called using 'System.Diagnostics' in .net. Through which we can enter details in to a cutom log and we can see the details . My point is it better to use the application orinted logging as we are doing or Is it better to use the 'System.Diagnostics.EventLog()' for logging the errors. Is any one worked on these concepts..? Please let me know the details. Adavanced Thanks, yeggu
-
Hi all, In my project we had system to log the exceptions through creating a text file for each day and writing the exceptions occured during tht day. The exceptions will be cathed through exception handling applied for necessary events. There is system class called using 'System.Diagnostics' in .net. Through which we can enter details in to a cutom log and we can see the details . My point is it better to use the application orinted logging as we are doing or Is it better to use the 'System.Diagnostics.EventLog()' for logging the errors. Is any one worked on these concepts..? Please let me know the details. Adavanced Thanks, yeggu
Microsoft is pushing System Diagnostics logging, but I think you can argue for and against both methods. There are two clear cut cases: 1) Windows Services should definitely use "System" logs. 2) If you still have to support Win98, there are no system logs, so a conventional file method is your only option. Of course you could create multiple versions, but I see no compelling reason to do so just for logging. There are pluses and minus for both. For example, if you need to troubleshoot a weird problem it is a lot simpler to ask a client to find a folder and e-mail you a log file than it is to try to explain to them how to save a System log to a file and send it. On the other hand if you actually have access to the Event log viewer, you can assign levels when you write messages and then System logs make it easy to find critical errors out of possibly a large number of insignificent messages. Personally, I use both methods. If it is an application that I will be managing directly on a server I have access to I will use a System log. If it is a "3rd party app" that I don't expect to have direct access to once I've released it I ten d to still use the old fashioned flat file approach for the reason I've mentioned - I can always request an error log by e-mail if a problem arises. You really have to evaluate your own specific situation.