Overwriting trace logs
-
2. prosince 2006 13:25
Hi,
I turn on logging for my wcf services and clients with some configuration like this:
<configuration> <system.diagnostics> <sources> <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true"> <listeners> <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData= "c:\log\Traces.svclog" /> </listeners> </source> </sources> </system.diagnostics> <configuration>That works fine, but the log file just keeps growing -- every time I restart the
log gets appended to instead of overwritten.
How can set this such that the log files are overwritten everytime the client or service
is restarted?Thanks!
Všechny reakce
-
2. prosince 2006 18:49Moderátor
Currently no, the trace logs are always appended to, and have a limit. You would have to write code to rename the old log so a new log is created. The trace logs are not useful for production logging in my opinion. I prefer to use a custom logging service that traces exceptions, for example. -
4. prosince 2006 21:00
You may use the Circular Tracing listener that is part of the SDK Management samples. This will create two files for you that will be overwritten in turn.
To use the trace listener, simplymodify the config files as showin in the sample.
Thanks,
Laurence