Trace Question
-
hi! i've a question about Trace. i want to use the trace (System.Diagnostic nemaspace) mechanism to generate (on demand) error and/or state messages for the eventlog. but it's only possible to generate information messages (Type=Information), no warnings or errors?! or is it possible anyway? :confused: here's my code:
TraceListener Listener=new EventLogTraceListener("myApp"); Trace.Listeners.Add(Listener); ... void doSometing() { try { //... do something } catch(Exception e) { //... handle exception and write message to eventlog... Trace.WriteLine(e.Message,"Error"); } }
thanks in advance! -
hi! i've a question about Trace. i want to use the trace (System.Diagnostic nemaspace) mechanism to generate (on demand) error and/or state messages for the eventlog. but it's only possible to generate information messages (Type=Information), no warnings or errors?! or is it possible anyway? :confused: here's my code:
TraceListener Listener=new EventLogTraceListener("myApp"); Trace.Listeners.Add(Listener); ... void doSometing() { try { //... do something } catch(Exception e) { //... handle exception and write message to eventlog... Trace.WriteLine(e.Message,"Error"); } }
thanks in advance!