J
Jason L James
Hi all,
can anyone help me with some tracing I am trying to do
in my application. I have a configuration file containing
the XML as detailed below:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<switches>
<add name="myBooleanSwitch" value="2" />
</switches>
</system.diagnostics>
</configuration>
I have declared a public variable as detailed below:
Public myBooleanSwitch As New BooleanSwitch("myBooleanSwitch",
"Controlss Data Tracing")
However, when I execute the code below, I only appear to insert
the unconditional trace.writeline command, and not the conditional
trace.writelineif command.
Dim myLog As New FileStream("C:\output.txt",
FileMode.OpenOrCreate)
Dim myTrace As New TextWriterTraceListener(myLog)
Trace.Listeners.Add(myTrace)
Trace.AutoFlush = True
Trace.WriteLineIf(myBooleanSwitch.Enabled, "Boolean Switch
Enabled")
Trace.WriteLine("Trace write line")
'Trace.Flush()
Trace.Close()
myLog.Close()
Trace.Listeners.Remove(myTrace)
myTrace.Dispose()
myLog = Nothing
Does anyone have any ideas? I created the configuration file,
called Debug_Trace Listener.config using the IDE (VB.Net). I
have even copied it to the bin folder and the debug folder to make
sure there it can be found.
Many thanks,
Jason.
can anyone help me with some tracing I am trying to do
in my application. I have a configuration file containing
the XML as detailed below:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<switches>
<add name="myBooleanSwitch" value="2" />
</switches>
</system.diagnostics>
</configuration>
I have declared a public variable as detailed below:
Public myBooleanSwitch As New BooleanSwitch("myBooleanSwitch",
"Controlss Data Tracing")
However, when I execute the code below, I only appear to insert
the unconditional trace.writeline command, and not the conditional
trace.writelineif command.
Dim myLog As New FileStream("C:\output.txt",
FileMode.OpenOrCreate)
Dim myTrace As New TextWriterTraceListener(myLog)
Trace.Listeners.Add(myTrace)
Trace.AutoFlush = True
Trace.WriteLineIf(myBooleanSwitch.Enabled, "Boolean Switch
Enabled")
Trace.WriteLine("Trace write line")
'Trace.Flush()
Trace.Close()
myLog.Close()
Trace.Listeners.Remove(myTrace)
myTrace.Dispose()
myLog = Nothing
Does anyone have any ideas? I created the configuration file,
called Debug_Trace Listener.config using the IDE (VB.Net). I
have even copied it to the bin folder and the debug folder to make
sure there it can be found.
Many thanks,
Jason.