I want to make calls like the following in my code:
System.Diagnostics.Trace.WriteLine("Starting XYZ...");
and write it to a file as described in the config:
<system.diagnostics>
<trace autoflush="true">
<listeners>
<add type="System.Diagnostics.TextWriterTraceListener" name="TextWriter"
initializeData="trace.log" />
</listeners>
</trace>
</system.diagnostics>
This works great, apart from the fact there are existing calls to WriteLine()
that are currently getting mixed up with the new lines of code I've added.
How can I write my trace to one log file and leave the existing ones as they are (currently no config at all before I amended it, I'd like the existing trace to be handled as it currently is).
I know this is achievable through code, but I'd like to specify the file in the config file and conditionally write to it.