Search code examples
c#.netprismtracesystem.diagnostics

How to specify a folder for a System.Diagnostics listener or filter in the xml?


we are working in a Prism application developing some modules that are deployed in a sub folder called Modules loaded by the bootstraper.

Now we need to deploy a new listener to write traces using System.Diagnostics.Tracing. This is how the app.config looks after we added our listener:

<sources>
  <source name="SourceName" switchValue="Information">
    <listeners>
      <add name="TextWriter" type="ListenerClassName, AssemblyName" initializeData="log.txt">
        <filter type="FilterClassName, AssemblyName"  />
      </add>
      <remove name="Default" />
    </listeners>
  </source>
</sources>

As we only develop modules we cannot deploy anything in the application folder. Is there a way to tell to the System.Diagnostics API where to find our AssemblyName?

Thanks!


Solution

  • I think you can only add the listener by code, in some static method that is called automatically when your module is loaded.