I've enabled logging on my desktop application by configuring app.config
<system.diagnostics>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="application.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
And then I can log on my application with a line like this
System.Diagnostics.Trace.TraceInformation("Start tailing file: {0}", watcher.FileLocation);
Now I want to enable the log file ONLY when I start application on Debug mode, because I don't want to distribute my package with log enabled.
Is there any way to configure it?