views:

18

answers:

0

Hello,

I have an application which uses My.Application.Log to store information at different listeners (to a file, to a remote screen and to a database). I would like to know if it is possible to set a different recording level for each listener. Currently what I have is:

<system.diagnostics>
<sources>
  <!-- This section defines the logging configuration for My.Application.Log -->
  <source name="DefaultSource" switchName="DefaultSwitch">
    <listeners>
      <add name="FileLog"/>
      <add name="ApplicationLog"/>
      <add name="DBLog"/>
    </listeners>
  </source>
</sources>
<switches>
  <add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
  <add name="FileLog"
       type="Sipro.Utils.Log.FileListener, Sipro.Utils, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null"
       autoflush="True"
       diskspaceexhaustedbehavior="DiscardMessages"
       logfilecreationschedule="Daily"
       maxfiles="31"
       fullinformation="True"
       includeDate="True"
       includeTicks="True"
       indentsize="4"
       indentcharacter=" "/>
  <add name="ApplicationLog" type="Sipro.Utils.Log.ApplicationListener, Sipro.Utils, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null"
       includeClass="False"
       includeMethod="False"
       includeThread="False"
       includeDate="True"
       includeTicks="True"
       size ="10000"
       />

As you can see there is only one DefaultSwitch that is used by all the listeners. Can I define a switch for each listener and how?

Thanks in advance.