Tracing

    Date: 01/13/05 (Asp Dot Net)    Keywords: asp, sql, web

    I'm having some trouble with tracing. I have a static class whose method I call from a page that I'd like to get trace data from. The method looks like:

    public sealed class DbUtils
    {
    static public int ExecuteNonQuery(string sql, string dsn)
    {
      Trace.WriteLine("SQL", sql);
      int rowsAffected;
    
      OdbcConnection db     = new OdbcConnection(dsn);
      db.Open();
      OdbcCommand    cmd    = new OdbcCommand(sql, db);
      rowsAffected = cmd.ExecuteNonQuery();
      db.Close();
      return rowsAffected;
    }
    }
    I've got trace="true" set on both the page I'm looking at and at the application (web.config). I get a lot of trace output at the bottom of the page or by looking at trace.axd, but I never see the information I'm trying to output in this function. Anyone know what I'm missing?

    Update:
    Apparently Page.Trace (from the aspx.cs page) and System.Diagnostics.Trace classes are different beasts. The proper way to make it work is to do this:
    System.Web.HttpContext.Current.Trace.Write("SQL", sql);

    Source: http://www.livejournal.com/community/aspdotnet/23616.html

« determine event raised in... || VisualStudio.net and CVS »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home