Problem with XmlTraceListener

Topics: Building and extending application blocks, Logging Application Block
Feb 7, 2007 at 5:00 PM
I am using this listener to produce .svclog files consumable by WCF's SvcTraceViewer. This app displays how long a given Activity took to execute. However this will not work with this listener, because the necessary xml element "TimeCreated" is always written as the same time, i.e. the time the LogSource was created. When the LogSource calls listener.TraceData() it passes the TraceEventCache object that it created in its constructor. The internals of the TraceData method decide what to put in the xml "TimeCreated" element by looking at the passed TraceEventCache.DateTime. Since this is always the same, we always see an elapsed time for Activites of 0 ms.

How can I get the TraceEventCache to have an updated time? Is this a configurable item? TraceEventCache.DateTime is read only, so I can't change it at log time.