Home All Groups Group Topic Archive Search About

Shared trace listener problem

Author
7 Jul 2006 8:56 AM
wozzer
I am experiencing a problem with shared trace listener when debugging with
Visual Studio 2005. I have a custom trace listener defined as a shared
listener and it is referenced from the trace section and from a trace source
section in the config file. The problem is that the TraceListener is created
twice when debugging causing file access problems, whereas it is only created
once if I run without debugger. Can anyone explain this? Example config file
below.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.diagnostics>
    <sharedListeners>
      <add initializeData="output.xml"
type="WINICS.Diagnostics.XmlWriterTraceListener,WINICS.Diagnostics" name
="WINICSTraceListener" />
    </sharedListeners>
    <sources>
      <source name="TestHarness" switchValue="Verbose">
        <listeners>
          <add name="WINICSTraceListener"/>
        </listeners>
      </source>
    </sources>
    <trace>
      <listeners>
        <add name="WINICSTraceListener" />
      </listeners>
    </trace>
  </system.diagnostics>
</configuration>

AddThis Social Bookmark Button