Hi Greg According to the following page you can have the defaults in the configuration file and override things in code as you need dynamically
http://msdn.microsoft.com/en-us/library/ms228984(v=vs.110).aspx Still need entries in a config file but they can be overridden which is good Thanks Tom On 2 December 2014 at 17:38, Greg Keogh <g...@mira.net> wrote: > Folks, many parts of the FCL (like Remoting and WCF) write trace > information out to a TraceSource class, presumably like this (does this > look right?): > > private TraceSource ts = new TraceSource("My.Library", SourceLevels.All); > : > ts.TraceInformation("Hello world!"); > > The only way I can find at the moment to listen to what a library like > that is tracing is to put something like this in the App's config file: > > <system.diagnostics> > <sources> > <source name="My.Library"> > <listeners> > <add name="consListener" > type="System.Diagnostics.ConsoleTraceListener"/> > </listeners> > </source> > </sources> > </system.diagnostics> > > Does anyone know how bypass the config section to do this in code? I've > been fiddling and searching the web but every example or tutorial I find > uses a config file. > > *Greg K* >