>As part of my .Net training today I have learnt about using the Event logs, setting our own performance counters and using the trace class and TraceSwitch.
>
>What I want to know is what is best practice or where can I read up on best practice for using these system facilities.
>
>IE.
>1. Should I just log application run and stop in the application log or should I log other information?
>2. Should I build in standard performance counters into my framework or just use them when trying to trace a performance issue?
>3. Should I build a full trace log into my framework and have a global setting to activate/deactivate?
>
>any info greatly appreciated.
>
>Gary.
A lot of .NET developers are using third party libraries like log4net. It lets you configure what type of logging you'd like to do and you can do things like call the logging class and specify a "level" of the log (so, via a .config file you can tell it to log basic events, log detailed events, log to a file, log to email, log to the event log, all of the above, some of the above, etc). Then, from within your app, you call it anyplace you think might be important if you were trying to debug an issue where you can't attach a debugger.
This gives you the flexibility to include as much detail as you'd like without having to incur the performance penalty to actually log everything unless it's really needed.
(hope that makes sense).