Thanks
That would provide one solution except if the application was installed in C:\Program Files (or C:\Program Files (x86)) they might not have permission to do this. Another difficulty would be if one wanted to be able to vary the switchValue from None to Warning or Error or Verbose or whatever else levels are available. Also I might want to redirect where the trace files are created. It looks like the best option is to do everything programmatically. This means I have to start almost from scratch. Using App.Config makes it very easy. Also I have no idea if I create a Trace Listener and bind that to my WCF web service endpoint to it writes trace information. Regards Peter From: [email protected] [mailto:[email protected]] On Behalf Of Preet Sangha Sent: Tuesday, 8 March 2011 1:04 PM To: ozDotNet Subject: Re: WCF TraceListeners Why not create a diagnostic app.config file too at deployment and the user can swap at diagnostic time? On 8 March 2011 17:25, Peter Maddin <[email protected]> wrote: For tracing using WCF services one adds a system.diagnostics section usually by using the WCF configuration editor during development. I would like to be able to adjust settings like this <configuration> <system.diagnostics> <sources> <source name="System.ServiceModel.MessageLogging" switchValue="None,ActivityTracing"> . . . to <configuration> <system.diagnostics> <sources> <source name="System.ServiceModel.MessageLogging" switchValue="Verbose,ActivityTracing"> . . . I need to be able to change or edit settings after deployment. . I don't want the client to edit the application.exe.config file directly (I could not think of anything riskier). . One does not normally have access to the clients workstation/server to edit this oneself on behalf of the end user. . The ConfgurationManager does not appear to have the capabilities of modifying the systems.diagnostics section. . One can create Tracelistener programmatically, but how does one wire this into the wcf client proxy so it generates the trace information? . Is it even possible to change the switchvalue programmatically? I have spent hours on this, googling, msdn etc. All I am getting is extremely frustrated. I cannot be the only one to need to adjust these settings. Even making changes and then having the end user to stop and restart the application for it to take effect would be ok. A while ago someone suggested using SourceSwitch http://msdn.microsoft.com/en-us/library/w65awck1.aspx but I don't see how this helps. There does not appear to be sufficient information on how to use this yet alone how to use it to alter the app.config settings programmatically after the application has been started. If it's not possible, I would like to know that, so I can stop belting my head against a wall trying to accomplish the impossible. Regards Peter Maddin Applications Development Officer PathWest Laboratory Medicine WA Phone : +618 6396 4285 Mobile: 0414 240 307 E-Mail : [email protected]; [email protected] The contents of this e-mail transmission outside of the WAGHS network are intended solely for the named recipient's), may be confidential, and may be privileged or otherwise protected from disclosure in the public interest. The use, reproduction, disclosure or distribution of the contents of this e-mail transmission by any person other than the named recipient(s) is prohibited. If you are not a named recipient please notify the sender immediately. -- regards, Preet, Overlooking the Ocean, Auckland
