Problem with loading app.config

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DoB

    #1

    Problem with loading app.config

    Hi,

    I was trying to configure the Trace class using the app.config. I was
    followig the example configurations in the MSDN.
    However, as I debug the program, the Trace class seems to ignore the
    configuration. For example - it has its default and only listener while I
    removed it and added some other listeners in a config file.

    Am I missing something? Is any explicit call needed to load the trace
    configuration part?

    DoB


  • Peter K

    #2
    Re: Problem with loading app.config

    "DoB" <DoB@dob.comwro te in news:uRq9i9uQIH A.1208@TK2MSFTN GP03.phx.gbl:
    Hi,
    >
    I was trying to configure the Trace class using the app.config. I was
    followig the example configurations in the MSDN.
    However, as I debug the program, the Trace class seems to ignore the
    configuration. For example - it has its default and only listener
    while I removed it and added some other listeners in a config file.
    >
    Am I missing something? Is any explicit call needed to load the trace
    configuration part?
    Hi - I think you need to be aware that "app.config " is not the real name of
    the configuration file your program uses (at least as far as I have seen).
    This might be the name you see in Visual Studio, but when you compile the
    file is automatically renamed to something like
    "application_na me.exe.config".

    So check this file exists and is in the right place.

    /Peter

    Comment

    • =?Utf-8?B?U29tIE5hdGggU2h1a2xh?=

      #3
      RE: Problem with loading app.config

      <configuratio n>
      <system.diagnos tics>
      <switches>
      <add name="DemoApp.S witch" value="Informat ion"/>
      </switches>
      <trace autoflush="true " indentsize="5">
      <listeners>
      <add name="DemoListe ner" type="System.Di agnostics.XmlWr iterTraceListen er"
      initializeData= "output.xml " />
      <remove name="Default" />

      <add name="DemoListe ner"
      type="System.Di agnostics.TextW riterTraceListe ner"
      initializeData= "output.txt " />
      <remove name="Default" />
      <add name="DemoListe ner"
      type="System.Di agnostics.Delim itedListTraceLi stener"
      delimiter="|"
      initializeData= "C:\\output.txt "/>
      <remove name="Default" />

      </listeners>
      </trace>

      </system.diagnost ics>
      </configuration>


      i have different listener u can use it according to uer convience
      "DoB" wrote:
      Hi,
      >
      I was trying to configure the Trace class using the app.config. I was
      followig the example configurations in the MSDN.
      However, as I debug the program, the Trace class seems to ignore the
      configuration. For example - it has its default and only listener while I
      removed it and added some other listeners in a config file.
      >
      Am I missing something? Is any explicit call needed to load the trace
      configuration part?
      >
      DoB
      >
      >
      >

      Comment

      • DoB

        #4
        Re: Problem with loading app.config

        OK. Solved.
        It was actually loading, but the configuration was incorrect :-)
        Sorry for troubling.

        DoB


        Comment

        Working...