Tracing Execution in Class Library

Discussion in 'ASP .Net' started by Graham Cottle, Jan 21, 2004.

  1. I have an ASP.NET and a Windows Forms Application which both use a shared
    class library.

    Is there a way which I can use the Trace Object in the class library so that
    I can get Trace Output sent to Trace.AXD when using it with the ASP.NET
    Application?

    I have inserted a number of Trace Statements, but they send output to the
    Visual Studio output window instead of the Trace.AXD output. If I put a
    Trace statement in a Web Page then I can get the output where I want it.

    I guess I need to use the System.Web.Trace object rather than the
    System.Diagnostics.Trace, but this needs an HTTPContext, which I cannot see
    how to get. I also don;t want to break compatibility with the Windows Forms
    application.

    Am I heading in the right direction?

    Thanks
    Graham Cottle
    Graham Cottle, Jan 21, 2004
    #1
    1. Advertising

  2. Graham Cottle

    Daniel Bass Guest

    if you know the file you wish to write to, why stick to the trace class?

    you could do something like

    LogTrace ( string szMyString )
    {
    StreamWriter wrter = File.AppendText ( "myOutputFile.txt" );
    wrter.WriteText ( szMyString );
    wrter.Flush();
    wrter.Close;
    }

    then call this function from where ever you want and you're doing
    essentially the same thing.

    hope that helps.

    Daniel.


    "Graham Cottle" <> wrote in message
    news:...
    I have an ASP.NET and a Windows Forms Application which both use a shared
    class library.

    Is there a way which I can use the Trace Object in the class library so that
    I can get Trace Output sent to Trace.AXD when using it with the ASP.NET
    Application?

    I have inserted a number of Trace Statements, but they send output to the
    Visual Studio output window instead of the Trace.AXD output. If I put a
    Trace statement in a Web Page then I can get the output where I want it.

    I guess I need to use the System.Web.Trace object rather than the
    System.Diagnostics.Trace, but this needs an HTTPContext, which I cannot see
    how to get. I also don;t want to break compatibility with the Windows Forms
    application.

    Am I heading in the right direction?

    Thanks
    Graham Cottle
    Daniel Bass, Jan 21, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U3RhbmxleSBBbGV4?=

    Enabling tracing in the constructor of a component class

    =?Utf-8?B?U3RhbmxleSBBbGV4?=, Dec 1, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    7,643
    =?Utf-8?B?U3RhbmxleSBBbGV4?=
    Dec 1, 2004
  2. Kurt Krueckeberg

    ray tracing library for windows

    Kurt Krueckeberg, Apr 19, 2004, in forum: C++
    Replies:
    1
    Views:
    472
    Christopher Benson-Manica
    Apr 19, 2004
  3. Michael B. Trausch

    Tracing the execution of scripts?

    Michael B. Trausch, Oct 27, 2006, in forum: Python
    Replies:
    10
    Views:
    458
    Ben Finney
    Oct 28, 2006
  4. Nikhil

    Dynamic tracing of C code execution

    Nikhil, May 12, 2006, in forum: C Programming
    Replies:
    5
    Views:
    1,600
    Frank Pittel
    May 16, 2006
  5. Sabiyur

    Code execution Tracing

    Sabiyur, Aug 16, 2006, in forum: C++
    Replies:
    1
    Views:
    330
    Jim Langston
    Aug 17, 2006
Loading...

Share This Page