c# - Clearing the log associated with a tracelistener after each run? -
I am using TextWriterTraceListener to log in, which is configured in app using app.config That's shown below.
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Configuration & gt; & Lt; System.diagnostics & gt; & Lt; Trace autoflush = "true" indentsize = "100" & gt; & Lt; Listeners & gt; & Lt; Add name = "myListener" type = "System.Diagnostics.TextWriterTraceListener" initializeData = "MyLog.log" /> & Lt; Remove name = "default" /> & Lt; / Listeners & gt; & Lt; / Trace & gt; & Lt; /system.diagnostics> & Lt; / Configuration & gt; How can I ensure that logging begins after each run instead of adding content to the existing logs?
Finding your own custom trace listener from the best way TextWriterTraceListener class Will happen. Which rolls a new log file at every interval. You should be able to modify this implementation.
Comments
Post a Comment