I am trying to understand the difference between Trace.Write
vs Trace.TraceInformation
and which one should be used.
I tried to configure traceOutputOptions
for timestamp/datetime. I just need an add timestamp with each message that I am writing. The datetime I am getting is a bit messay as it appends application name and less user friendly time stamp in next line like below.
ConsoleApplication1.exe Information: 0 : Hello - Trace!
DateTime=2011-01-31T14:26:11.1538509Z
ConsoleApplication1.exe Error: 0 : Hello - Trace!
DateTime=2011-01-31T14:26:11.1538509Z
All I need is something like
2011-01-31 11:32 Information: Hello - Trace!
2011-01-31 11:33 Error: Hello - Trace!
Is there any easy way of setting it up in App.config
doing it?
Trace.Write
and its ilk are the "old way" to trace (using OutputDebugString). The "new way" is with Trace Sources: msdn.microsoft.com/en-us/library/ms228989.aspx – Nettlesome