none
how to use configuration sections? RRS feed

  • Question

  • Hi!

    We are developing a plugin for a system that apparently uses some  sort of configuration merging.

    So, the config fiel we have looks like

    <configuration>
      <configSections>
        <section name="X.Y.Components" type="X.Internal.ConfigurationSectionHandler, X.ComponentsImpl"/>
        <section .../>
        <section .../>
      </configSections>
    
    <X.Y.Components type="X.Components.ComponentReferenceConfiguration, X.Components">
        <Component Type="something, whatever" />        
    </X.Y.Components>
    ...
    </configuration>

    Now what we want to add is a trace source and listeners and just adding it like

    <configuration>
      <configSections>
        <section name="X.Y.Components" type="X.Internal.ConfigurationSectionHandler, X.ComponentsImpl"/>
        <section .../>
        <section .../>
      </configSections>
    
      <X.Y.Components type="X.Components.ComponentReferenceConfiguration, X.Components">
        <Component Type="something, whatever" />        
      </X.Y.Components>
      <system.diagnostics>
        <sources>
          <source name ="UTTS"  switchValue="All">
            <listeners>
              <add name="Console" type="System.Diagnostics.ConsoleTraceListener" />
              <add name="CsvLogger" type="UnittestTraceListener.UnittestTraceListener, UnittestTraceListener" initializeData="C:\Users\v.hetzer\AppData\Local\Temp\x.csv"/>
              <add name="TextLogger" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\Users\v.hetzer\AppData\Local\Temp\x.log" />
            </listeners>
          </source>
        </sources>
        <trace autoflush="true"/>
      </system.diagnostics>
    </configuration>

    gives us an error. So how do I properly declare a config section for a trace source and listeners?

    Lots of Greetings!

    Volker

    Wednesday, February 12, 2014 1:14 PM

Answers