Is there a way to enable/disable the WCF trace/logging for a perticular end point without changing the web.config ?
You first need to access the trace object by name, as its defined in the .config file. For example:
TraceSource ts = new TraceSource("System.ServiceModel");
Then you can set the filter level to all, none or anything in between:
ts.Switch.Level = SourceLevels.Off; // nothing
ts.Switch.Level = SourceLevels.All; // everything
ts.Switch.Level = SourceLevels.Warning; //warning or higher
BTW - the TraceSource
class is in the System.Diagnostics
namespace, so don't forget the appropriate using
statement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With