Read the article
WCF Tracing FAQs WCF Tracing FAQs[
^] which is a good introduction however I would like to override setting in my config file in system.dianostics section
If I have configured my trace listeners in my web.config/ap.config file. How can can I override these programmtically. For example if I have
<source propagateActivity="true" name="System.ServiceModel" switchValue="Off,ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelTraceListener">
<filter type="" />
</add>
</listeners>
</source
and I need to change the switchValue to say warning
<source propagateActivity="true" name="System.ServiceModel" switchValue="Warning,ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelTraceListener">
<filter type="" />
</add>
</listeners>
</source>
one can simply edit the appropriate config file.
However for end users one does not want them to edit these files.
What one would like is to have these values established from the config files and then have an option within one's application
to alter these settings programmtically so only specific values (switchValue in this case) are changed.
One would normally not want tracing on but if a user has problems the user can set activate the trace to some level and then e-mail back the trace log for analysis.
So one would like:
1. Start application
2. Apllication reads in config file settings.
3. [Optionally read in user preferences from a separate source (file, database etc) and use these to override config file settings]
4. Provide the option for the user to programmtically override some settings while application is running.
5. [Optionally persist user override preferences to another storage mechanism (file, database etc)]
One does not want to edit or persist changes to the original config files. If one needs persist changes then one would have a separate persistant store with overrides and apply any changes after the original config file is processed. However for the most part one would only like a temporary override while the application is running.
Is this possible? :confused:
From what research I have done one can set up these settings programmatically
or from a config file. There does not seem to be any information on how to have a
hybrid of the two, use the config file to establish base values and then programmatically override some. :sigh: