• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

TraceSwitch

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    TraceSwitch

    I have a WPF C# app. I have a config file in the same folder as the exe

    myapp.exe.config

    I have a traceswitch defined thus

    <configuration>
    <system.diagnostics>
    <trace autoflush="false" indentsize="4">
    <listeners>
    <add name="traceListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="TextWriterOutput.log" />
    <remove name="Default" />
    </listeners>
    </trace>
    <switches>
    <add name="traceSwitch" value="4" />
    </switches>
    </system.diagnostics>
    </configuration>

    However, the little love won't pick up it's setting form the config file.

    Any ideas what I am doing wrong? Driving me mental.

    private static TraceSwitch traceSwitch = new TraceSwitch("traceSwitch", "My Trace Switch");
    Knock first as I might be balancing my chakras.

    #2
    Looks okay to me. Are you sure you are compliling with debug or tracing on?

    Comment


      #3
      Just tried it (new WPF app with your config) and it worked fine.

      EDIT: Can your code read anything (appSettings perhaps) from the config file?
      Last edited by voodooflux; 18 August 2009, 12:35.
      Where are we going? And what’s with this hand basket?

      Comment


        #4
        I am an idiot. (We already knew this).

        I flicked the folder listing into "Detailed" in explorer and saw

        myApp.exe.config.txt

        And wept.

        Knock first as I might be balancing my chakras.

        Comment


          #5
          Originally posted by suityou01 View Post
          I am an idiot. (We already knew this).

          I flicked the folder listing into "Detailed" in explorer and saw

          myApp.exe.config.txt

          And wept.

          Christ alive! This and databinding arrays.

          Comment


            #6
            Originally posted by DimPrawn View Post
            Christ alive! This and databinding arrays.

            Predicatable DP. I can get some MCP training on Notepad, you on the other hand will always be ugly.

            HTH
            Knock first as I might be balancing my chakras.

            Comment


              #7
              Originally posted by suityou01 View Post
              Predicatable DP. I can get some MCP training on Notepad, you on the other hand will always be ugly.

              HTH
              Oh, so Microsoft operating systems are still associating files to applications based on the characters following the last period of the file name? How quaint.

              Comment


                #8
                Originally posted by expat View Post
                Oh, so Microsoft operating systems are still associating files to applications based on the characters following the last period of the file name? How quaint.
                Automagically. Wonderful isn't it?

                I'm still a knob though.
                Knock first as I might be balancing my chakras.

                Comment


                  #9
                  Originally posted by suityou01 View Post

                  I'm still a knob though.

                  WHS.

                  Comment

                  Working...
                  X