471,310 Members | 1,098 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

refreshing TraceSwitch settings

I have developed an XML-based tracelistener which uses a booleanswitch
(enable/disable), a general traceswitch (set the tracelevel) and a
userspecific traceswitch (set the tracelevel for a particular user).
Those switches are set in app.config

Now I am looking for a way to know when these settings in my app.config have
changed (for example, when changing the tracelevel) at runtime, so that my
application can use the new settings.
When I check traceSwitch.Level in my code while debugging, it seems that it
doesn't use the new level until I restart the application.

Is there a way to "refresh" this dynamically at runtime without having to
restart the application?

My config file looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<switches>
<add name="GeneralBooleanSwitch" value="1" />
<add name="GeneralTraceSwitch" value="1" />
<add name="UserSpecificTraceSwitch" value="4" />
</switches>
<trace autoflush="true" indentsize="2">
<listeners>
<add name="MyTraceListener"
type="..."
initializeData="..."/>
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
<appSettings>
<add key="UserSpecificTraceUsers" value="User1,User2" />
....
</appSettings>
</configuration>
Jul 21 '05 #1
0 1161

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Scott Tilton | last post: by
2 posts views Thread by nhmark64 | last post: by
reply views Thread by Kevin Meiresonne | last post: by
1 post views Thread by David | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.