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: 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?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; } } 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
|