I have a situation where I need to capture the trace from System.Workflow.Activities.Rules. Currently I have a custom trace listner configurered like so in code:
_traceListener = new InMemoryTraceListener();
System.Diagnostics.Trace.Listeners.Add(_traceListener);
and in the app.config I have the source switch configured like so:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<switches>
<add name="System.Workflow.Activities.Rules" value="Information"/>
</switches>
</system.diagnostics>
</configuration>
This works and I am able to capture the race messages in my custom trace listener. I need the trace information as it is critical to the overall solution and is set at the level required.
But as I need to configure the switch programatically instead of through configuration as its going into a dll for the GAC.
I have tried a number of different things with SourceSwitch and TraceSource but none of them have worked for me.
Edit: In summary I want to programatically configure a switch for an existing source from the .net framework so that I can listen to trace messages.