G
Guest
I've configured Trace switch in my app.config file:
DebugLevel = new TraceSwitch("DebugLevel", "Trace Level for Entire
Application");
and have created and initialized a trace listener in my application code:
FileStream m_Stream = new FileStream(m_logFile, FileMode.Append,
FileAccess.Write);
myTextListener = new TextWriterTraceListener(m_Stream);
Trace.Listeners.Add(myTextListener);
usage in my code:
Trace.WriteLine(DebugLevel.TraceInfo, String.Format("{0} Trace Level={1}",
DateTime.Now, DebugLevel.Level));
output in the log file:
6/13/2007 10:34:49 AM Trace Level=Verbose: True
format of the output I would like to see:
6/13/2007 10:34:49 AM Trace Level=Verbose
(don't want to see any ": True" or ":False" appended to each msg)
The ": True" or ": False" go away if I re-write my code as:
Trace.WriteLine(DateTime.Now, DebugLevel.TraceInfo);
However, I would like to use the String.Format("{0} Trace Level={1}", .....)
as it is very handy with multiple variables to be written to a log file.
Can anyone help me get rid of this ": True" or ": False" in the Trace msgs
in my logfile ?
Thanks in advance.
DebugLevel = new TraceSwitch("DebugLevel", "Trace Level for Entire
Application");
and have created and initialized a trace listener in my application code:
FileStream m_Stream = new FileStream(m_logFile, FileMode.Append,
FileAccess.Write);
myTextListener = new TextWriterTraceListener(m_Stream);
Trace.Listeners.Add(myTextListener);
usage in my code:
Trace.WriteLine(DebugLevel.TraceInfo, String.Format("{0} Trace Level={1}",
DateTime.Now, DebugLevel.Level));
output in the log file:
6/13/2007 10:34:49 AM Trace Level=Verbose: True
format of the output I would like to see:
6/13/2007 10:34:49 AM Trace Level=Verbose
(don't want to see any ": True" or ":False" appended to each msg)
The ": True" or ": False" go away if I re-write my code as:
Trace.WriteLine(DateTime.Now, DebugLevel.TraceInfo);
However, I would like to use the String.Format("{0} Trace Level={1}", .....)
as it is very handy with multiple variables to be written to a log file.
Can anyone help me get rid of this ": True" or ": False" in the Trace msgs
in my logfile ?
Thanks in advance.