Trace class

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

    #1

    Trace class

    Hi,

    The trace class seems to me to be very usefull however there are a few
    features of it that have to confused.
    I am using visual studio 2003.

    the IDE will not let me write

    trace.assert(.. ) or trace.writeLine (..) or trace.writeif(. .)

    but it will let me write
    debug.assert(.. ) or debug.writeLine (..) or debug.writeif(. .)

    it is as if it does recognise these methods of the trace class.

    I was also interested to note that I can use trace.write(..) , trace.warn(..)
    without importing system.diagnost ics
    however I must import system.diagnost ics to use debug.assert(.. ) ,
    debug.writeline (..)

    maybe I need to employ trace listeners to use these methods of the trace
    class???

    I am a little confused and would appreciate somebody clearing this up for
    me.

    cheers

    martin.


  • Rad

    #2
    Re: Trace class

    You may have confused the two Trace classes.. one's specific to web
    applications, and the other comes from System.Diagnost ics as you already
    noted...

    That might be the explanation...


    "martin" <martincello67@ hotmail.com> wrote in message
    news:Ooe4G%23cl DHA.2328@TK2MSF TNGP10.phx.gbl. ..[color=blue]
    > Hi,
    >
    > The trace class seems to me to be very usefull however there are a few
    > features of it that have to confused.
    > I am using visual studio 2003.
    >
    > the IDE will not let me write
    >
    > trace.assert(.. ) or trace.writeLine (..) or trace.writeif(. .)
    >
    > but it will let me write
    > debug.assert(.. ) or debug.writeLine (..) or debug.writeif(. .)
    >
    > it is as if it does recognise these methods of the trace class.
    >
    > I was also interested to note that I can use trace.write(..) ,[/color]
    trace.warn(..)[color=blue]
    > without importing system.diagnost ics
    > however I must import system.diagnost ics to use debug.assert(.. ) ,
    > debug.writeline (..)
    >
    > maybe I need to employ trace listeners to use these methods of the trace
    > class???
    >
    > I am a little confused and would appreciate somebody clearing this up for
    > me.
    >
    > cheers
    >
    > martin.
    >
    >[/color]


    Comment

    • martin

      #3
      Re: Trace class

      Thanks for that Rad,

      you are indeed correct I was confusing the two. because if i write
      System.Diagnost ics.Trace.Write ("System.Diagno stics.Trace.Wri te") then I can
      see this being written to the output window.

      the trace I was original refering too belongs to TraceContext Class

      this brings up an interesting point.

      if I have the follwoing defined in an asp dotnet application that is built
      for debug
      Debug.Assert(Tr ue, "From Assert -- True")
      Debug.WriteIf(T rue, "Message written by debug.WriteIf" & vbCrLf)
      Trace.Warn("Pag e_Load", "Finished Page_Load")

      System.Diagnost ics.Trace.Write Line("System.Di agnostics.Trace .WriteLine" &
      vbCrLf)
      System.Diagnost ics.Trace.Write ("System.Diagno stics.Trace.Wri te" &
      vbCrLf)

      then when it is run in the debugger the trace information can be seen in the
      output window.
      I keep reading stuff that says when the application is complied for release
      the debug stuff is taken out but trace stuff is left in.

      This seems odd as the only place that I can see the trace stuff is in the
      debugger, so if its a non debug version I' knid of stuck.

      I was hoping that I could leave the trace stuff in my application when it
      was compiled for realease and simple turn tracing on or off in web.config,
      and then I would be able to see any of the system.diagnost ics.trace out put
      either at the bottom of the web page ot in trace.axd, but this appears not
      to be the case.
      I am missing something here.
      is the <trace> element in web.config only connected to the TraceContext
      Class and has nothing to do with the system.diagnost ics.trace class.

      many thanks for any advice that can be offered.

      cheers

      martin.






      "Rad" <aspdotnet@hot. spam.mail.com> wrote in message
      news:Prlkb.3561 7$SE3.15252@twi ster.southeast. rr.com...[color=blue]
      > You may have confused the two Trace classes.. one's specific to web
      > applications, and the other comes from System.Diagnost ics as you already
      > noted...
      >
      > That might be the explanation...
      >
      >
      > "martin" <martincello67@ hotmail.com> wrote in message
      > news:Ooe4G%23cl DHA.2328@TK2MSF TNGP10.phx.gbl. ..[color=green]
      > > Hi,
      > >
      > > The trace class seems to me to be very usefull however there are a few
      > > features of it that have to confused.
      > > I am using visual studio 2003.
      > >
      > > the IDE will not let me write
      > >
      > > trace.assert(.. ) or trace.writeLine (..) or trace.writeif(. .)
      > >
      > > but it will let me write
      > > debug.assert(.. ) or debug.writeLine (..) or debug.writeif(. .)
      > >
      > > it is as if it does recognise these methods of the trace class.
      > >
      > > I was also interested to note that I can use trace.write(..) ,[/color]
      > trace.warn(..)[color=green]
      > > without importing system.diagnost ics
      > > however I must import system.diagnost ics to use debug.assert(.. ) ,
      > > debug.writeline (..)
      > >
      > > maybe I need to employ trace listeners to use these methods of the trace
      > > class???
      > >
      > > I am a little confused and would appreciate somebody clearing this up[/color][/color]
      for[color=blue][color=green]
      > > me.
      > >
      > > cheers
      > >
      > > martin.
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • martin

        #4
        Re: Trace class

        Thanks for that Rad,

        you are indeed correct I was confusing the two. because if i write
        System.Diagnost ics.Trace.Write ("System.Diagno stics.Trace.Wri te") then I can
        see this being written to the output window.

        the trace I was original refering too belongs to TraceContext Class

        this brings up an interesting point.

        if I have the follwoing defined in an asp dotnet application that is built
        for debug
        Debug.Assert(Tr ue, "From Assert -- True")
        Debug.WriteIf(T rue, "Message written by debug.WriteIf" & vbCrLf)
        Trace.Warn("Pag e_Load", "Finished Page_Load")

        System.Diagnost ics.Trace.Write Line("System.Di agnostics.Trace .WriteLine" &
        vbCrLf)
        System.Diagnost ics.Trace.Write ("System.Diagno stics.Trace.Wri te" &
        vbCrLf)

        then when it is run in the debugger the trace information can be seen in the
        output window.
        I keep reading stuff that says when the application is complied for release
        the debug stuff is taken out but trace stuff is left in.

        This seems odd as the only place that I can see the trace stuff is in the
        debugger, so if its a non debug version I' knid of stuck.

        I was hoping that I could leave the trace stuff in my application when it
        was compiled for realease and simple turn tracing on or off in web.config,
        and then I would be able to see any of the system.diagnost ics.trace out put
        either at the bottom of the web page ot in trace.axd, but this appears not
        to be the case.
        I am missing something here.
        is the <trace> element in web.config only connected to the TraceContext
        Class and has nothing to do with the system.diagnost ics.trace class.

        many thanks for any advice that can be offered.

        cheers

        martin.






        "Rad" <aspdotnet@hot. spam.mail.com> wrote in message
        news:Prlkb.3561 7$SE3.15252@twi ster.southeast. rr.com...[color=blue]
        > You may have confused the two Trace classes.. one's specific to web
        > applications, and the other comes from System.Diagnost ics as you already
        > noted...
        >
        > That might be the explanation...
        >
        >
        > "martin" <martincello67@ hotmail.com> wrote in message
        > news:Ooe4G%23cl DHA.2328@TK2MSF TNGP10.phx.gbl. ..[color=green]
        > > Hi,
        > >
        > > The trace class seems to me to be very usefull however there are a few
        > > features of it that have to confused.
        > > I am using visual studio 2003.
        > >
        > > the IDE will not let me write
        > >
        > > trace.assert(.. ) or trace.writeLine (..) or trace.writeif(. .)
        > >
        > > but it will let me write
        > > debug.assert(.. ) or debug.writeLine (..) or debug.writeif(. .)
        > >
        > > it is as if it does recognise these methods of the trace class.
        > >
        > > I was also interested to note that I can use trace.write(..) ,[/color]
        > trace.warn(..)[color=green]
        > > without importing system.diagnost ics
        > > however I must import system.diagnost ics to use debug.assert(.. ) ,
        > > debug.writeline (..)
        > >
        > > maybe I need to employ trace listeners to use these methods of the trace
        > > class???
        > >
        > > I am a little confused and would appreciate somebody clearing this up[/color][/color]
        for[color=blue][color=green]
        > > me.
        > >
        > > cheers
        > >
        > > martin.
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Rad

          #5
          Re: Trace class

          It'd be best to read up on tracing in asp.net -- it's a separate "topic."
          There's more info and some of the confusion you mentioned below will clear
          up. I'm afraid you're still mixing them up to a certain degree. more or
          less, there's no need to use System.Diagnost ics.Trace in a web app.. just
          use Trace...

          you can then either check up trace.axd or simply turn on trace=true in the
          @Page directive.. and see the output on the page right away..


          "martin" <martincello67@ hotmail.com> wrote in message
          news:eMkFHDglDH A.2080@TK2MSFTN GP10.phx.gbl...[color=blue]
          > Thanks for that Rad,
          >
          > you are indeed correct I was confusing the two. because if i write
          > System.Diagnost ics.Trace.Write ("System.Diagno stics.Trace.Wri te") then I[/color]
          can[color=blue]
          > see this being written to the output window.
          >
          > the trace I was original refering too belongs to TraceContext Class
          >
          > this brings up an interesting point.
          >
          > if I have the follwoing defined in an asp dotnet application that is built
          > for debug
          > Debug.Assert(Tr ue, "From Assert -- True")
          > Debug.WriteIf(T rue, "Message written by debug.WriteIf" & vbCrLf)
          > Trace.Warn("Pag e_Load", "Finished Page_Load")
          >
          > System.Diagnost ics.Trace.Write Line("System.Di agnostics.Trace .WriteLine" &
          > vbCrLf)
          > System.Diagnost ics.Trace.Write ("System.Diagno stics.Trace.Wri te" &
          > vbCrLf)
          >
          > then when it is run in the debugger the trace information can be seen in[/color]
          the[color=blue]
          > output window.
          > I keep reading stuff that says when the application is complied for[/color]
          release[color=blue]
          > the debug stuff is taken out but trace stuff is left in.
          >
          > This seems odd as the only place that I can see the trace stuff is in the
          > debugger, so if its a non debug version I' knid of stuck.
          >
          > I was hoping that I could leave the trace stuff in my application when it
          > was compiled for realease and simple turn tracing on or off in web.config,
          > and then I would be able to see any of the system.diagnost ics.trace out[/color]
          put[color=blue]
          > either at the bottom of the web page ot in trace.axd, but this appears not
          > to be the case.
          > I am missing something here.
          > is the <trace> element in web.config only connected to the TraceContext
          > Class and has nothing to do with the system.diagnost ics.trace class.
          >
          > many thanks for any advice that can be offered.
          >
          > cheers
          >
          > martin.
          >
          >
          >
          >
          >
          >
          > "Rad" <aspdotnet@hot. spam.mail.com> wrote in message
          > news:Prlkb.3561 7$SE3.15252@twi ster.southeast. rr.com...[color=green]
          > > You may have confused the two Trace classes.. one's specific to web
          > > applications, and the other comes from System.Diagnost ics as you already
          > > noted...
          > >
          > > That might be the explanation...
          > >
          > >
          > > "martin" <martincello67@ hotmail.com> wrote in message
          > > news:Ooe4G%23cl DHA.2328@TK2MSF TNGP10.phx.gbl. ..[color=darkred]
          > > > Hi,
          > > >
          > > > The trace class seems to me to be very usefull however there are a few
          > > > features of it that have to confused.
          > > > I am using visual studio 2003.
          > > >
          > > > the IDE will not let me write
          > > >
          > > > trace.assert(.. ) or trace.writeLine (..) or trace.writeif(. .)
          > > >
          > > > but it will let me write
          > > > debug.assert(.. ) or debug.writeLine (..) or debug.writeif(. .)
          > > >
          > > > it is as if it does recognise these methods of the trace class.
          > > >
          > > > I was also interested to note that I can use trace.write(..) ,[/color]
          > > trace.warn(..)[color=darkred]
          > > > without importing system.diagnost ics
          > > > however I must import system.diagnost ics to use debug.assert(.. ) ,
          > > > debug.writeline (..)
          > > >
          > > > maybe I need to employ trace listeners to use these methods of the[/color][/color][/color]
          trace[color=blue][color=green][color=darkred]
          > > > class???
          > > >
          > > > I am a little confused and would appreciate somebody clearing this up[/color][/color]
          > for[color=green][color=darkred]
          > > > me.
          > > >
          > > > cheers
          > > >
          > > > martin.
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Rad

            #6
            Re: Trace class

            It'd be best to read up on tracing in asp.net -- it's a separate "topic."
            There's more info and some of the confusion you mentioned below will clear
            up. I'm afraid you're still mixing them up to a certain degree. more or
            less, there's no need to use System.Diagnost ics.Trace in a web app.. just
            use Trace...

            you can then either check up trace.axd or simply turn on trace=true in the
            @Page directive.. and see the output on the page right away..


            "martin" <martincello67@ hotmail.com> wrote in message
            news:eMkFHDglDH A.2080@TK2MSFTN GP10.phx.gbl...[color=blue]
            > Thanks for that Rad,
            >
            > you are indeed correct I was confusing the two. because if i write
            > System.Diagnost ics.Trace.Write ("System.Diagno stics.Trace.Wri te") then I[/color]
            can[color=blue]
            > see this being written to the output window.
            >
            > the trace I was original refering too belongs to TraceContext Class
            >
            > this brings up an interesting point.
            >
            > if I have the follwoing defined in an asp dotnet application that is built
            > for debug
            > Debug.Assert(Tr ue, "From Assert -- True")
            > Debug.WriteIf(T rue, "Message written by debug.WriteIf" & vbCrLf)
            > Trace.Warn("Pag e_Load", "Finished Page_Load")
            >
            > System.Diagnost ics.Trace.Write Line("System.Di agnostics.Trace .WriteLine" &
            > vbCrLf)
            > System.Diagnost ics.Trace.Write ("System.Diagno stics.Trace.Wri te" &
            > vbCrLf)
            >
            > then when it is run in the debugger the trace information can be seen in[/color]
            the[color=blue]
            > output window.
            > I keep reading stuff that says when the application is complied for[/color]
            release[color=blue]
            > the debug stuff is taken out but trace stuff is left in.
            >
            > This seems odd as the only place that I can see the trace stuff is in the
            > debugger, so if its a non debug version I' knid of stuck.
            >
            > I was hoping that I could leave the trace stuff in my application when it
            > was compiled for realease and simple turn tracing on or off in web.config,
            > and then I would be able to see any of the system.diagnost ics.trace out[/color]
            put[color=blue]
            > either at the bottom of the web page ot in trace.axd, but this appears not
            > to be the case.
            > I am missing something here.
            > is the <trace> element in web.config only connected to the TraceContext
            > Class and has nothing to do with the system.diagnost ics.trace class.
            >
            > many thanks for any advice that can be offered.
            >
            > cheers
            >
            > martin.
            >
            >
            >
            >
            >
            >
            > "Rad" <aspdotnet@hot. spam.mail.com> wrote in message
            > news:Prlkb.3561 7$SE3.15252@twi ster.southeast. rr.com...[color=green]
            > > You may have confused the two Trace classes.. one's specific to web
            > > applications, and the other comes from System.Diagnost ics as you already
            > > noted...
            > >
            > > That might be the explanation...
            > >
            > >
            > > "martin" <martincello67@ hotmail.com> wrote in message
            > > news:Ooe4G%23cl DHA.2328@TK2MSF TNGP10.phx.gbl. ..[color=darkred]
            > > > Hi,
            > > >
            > > > The trace class seems to me to be very usefull however there are a few
            > > > features of it that have to confused.
            > > > I am using visual studio 2003.
            > > >
            > > > the IDE will not let me write
            > > >
            > > > trace.assert(.. ) or trace.writeLine (..) or trace.writeif(. .)
            > > >
            > > > but it will let me write
            > > > debug.assert(.. ) or debug.writeLine (..) or debug.writeif(. .)
            > > >
            > > > it is as if it does recognise these methods of the trace class.
            > > >
            > > > I was also interested to note that I can use trace.write(..) ,[/color]
            > > trace.warn(..)[color=darkred]
            > > > without importing system.diagnost ics
            > > > however I must import system.diagnost ics to use debug.assert(.. ) ,
            > > > debug.writeline (..)
            > > >
            > > > maybe I need to employ trace listeners to use these methods of the[/color][/color][/color]
            trace[color=blue][color=green][color=darkred]
            > > > class???
            > > >
            > > > I am a little confused and would appreciate somebody clearing this up[/color][/color]
            > for[color=green][color=darkred]
            > > > me.
            > > >
            > > > cheers
            > > >
            > > > martin.
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            Working...