URGENT: Need to trace generated SQL

Posts   
 
    
EdDotNet
User
Posts: 31
Joined: 30-Mar-2005
# Posted on: 06-Apr-2006 04:25:54   

To whomever can help, please do.

We need to trace generated SQL in a web applicaiton that we are having performance issues with in our production environment (read: we cannot attach the debugger to it)

I've already read this post: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=2408&HighLight=1

and others, and I am aware of the settings to get the generated SQL to show up in the Console window in Visual Studio.NET. This IS NOT what we need.

We need to see the generated SQL in TRACE output for a web application.

for example, if we were to view the application trace by turning it on in web.config in the <trace> node, we would expect to see the Sql output at the bottom of the page or in the "trace.axd" file.

I am hoping that someone has figured out how to do this. If not, can someone at LLBLGEN please create a build for us that does a Trace.WriteLine on every Sql statement?

Posts: 1255
Joined: 10-Mar-2006
# Posted on: 06-Apr-2006 07:06:57   

The generated SQL goes to any trace listener. You can setup a trace listener in the config file to grab the output from LLBLGen (that normally goes to the output window) and direct it anywhere you want.

I think this will do it....

<system.diagnostics> <trace> <listeners> <add name="WebPageTraceListener" type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> </listeners> </trace> </system.diagnostics

Here is an article on it... http://msdn2.microsoft.com/en-US/library/b0ectfxd.aspx

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 06-Apr-2006 08:54:25   
EdDotNet
User
Posts: 31
Joined: 30-Mar-2005
# Posted on: 06-Apr-2006 15:14:13   

WayneBrantley wrote:

The generated SQL goes to any trace listener. You can setup a trace listener in the config file to grab the output from LLBLGen (that normally goes to the output window) and direct it anywhere you want.

I think this will do it....

<system.diagnostics> <trace> <listeners> <add name="WebPageTraceListener" type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> </listeners> </trace> </system.diagnostics

Here is an article on it... http://msdn2.microsoft.com/en-US/library/b0ectfxd.aspx

Wayne Thank you I will try this right away.

EdDotNet
User
Posts: 31
Joined: 30-Mar-2005
# Posted on: 06-Apr-2006 15:14:38   

Walaa wrote:

Same issue was discussed here: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=3711

As far as I can tell that post gives zero details on how to output the LLBLGen trace to ASP.NET web tracing.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 06-Apr-2006 15:53:58   

The following was a suggestion posted by Frans in the above mentoned thread:

You can do that yourself if you want to: derive a class from DataAccessAdapter and override OnSaveEntity/OnFetchEntity etc. You'll receive an IActionQuery or IRetrievalQuery object which contains a IDbCommand object with the query. In the 3rd party section there's even a template which does that for you.

EdDotNet
User
Posts: 31
Joined: 30-Mar-2005
# Posted on: 06-Apr-2006 17:49:43   

EdDotNet wrote:

WayneBrantley wrote:

The generated SQL goes to any trace listener. You can setup a trace listener in the config file to grab the output from LLBLGen (that normally goes to the output window) and direct it anywhere you want.

I think this will do it....

<system.diagnostics> <trace> <listeners> <add name="WebPageTraceListener" type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> </listeners> </trace> </system.diagnostics

Here is an article on it... http://msdn2.microsoft.com/en-US/library/b0ectfxd.aspx

Wayne Thank you I will try this right away.

No dice on this approach. WebPageTraceListener Class Note: This class is new in the .NET Framework version 2.0 WebPageTraceListener is .net 2.0 class We are using NET 1.1

I will check out the below suggestion, pending that is there any simple way to route that LLBLGen outpout to ASP.NET trace?

EdDotNet
User
Posts: 31
Joined: 30-Mar-2005
# Posted on: 06-Apr-2006 17:53:18   

Walaa wrote:

The following was a suggestion posted by Frans in the above mentoned thread:

You can do that yourself if you want to: derive a class from DataAccessAdapter and override OnSaveEntity/OnFetchEntity etc. You'll receive an IActionQuery or IRetrievalQuery object which contains a IDbCommand object with the query. In the 3rd party section there's even a template which does that for you.

Where exactly on this page: http://www.llblgen.com/pages/secure/thirdparty.aspx Is this template that does this for me?

jtgooding
User
Posts: 126
Joined: 26-Apr-2004
# Posted on: 06-Apr-2006 19:22:45   

I wrote the template in question, it appears to have fallen off the list, if Frans doesn't throw it back up on the page, I can send you the code changes for you to integrate into the current release.

Trace listners in my opinon are a wonderful idea just horribly implemented, they don't work in any component architecture properly, such as com, asp etc.

John

EdDotNet
User
Posts: 31
Joined: 30-Mar-2005
# Posted on: 06-Apr-2006 20:33:54   

jtgooding wrote:

I wrote the template in question, it appears to have fallen off the list, if Frans doesn't throw it back up on the page, I can send you the code changes for you to integrate into the current release.

Trace listners in my opinon are a wonderful idea just horribly implemented, they don't work in any component architecture properly, such as com, asp etc.

John

Please please please send me the templates or whatever I can use for the current release. Email edltech@^^^g^mail.com (remove the ^'s)

thanks

jtgooding
User
Posts: 126
Joined: 26-Apr-2004
# Posted on: 06-Apr-2006 20:56:41   

sent if you want to edit out your email.

John

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 07-Apr-2006 08:42:12   

You can redirect the trace info to any destination you want. Just write a little tracelistener or let log4net listen to your trace output, though you can for example redirect the trace output to a file, see the petshop project example on our website for an example of this (web.config file).

Frans Bouma | Lead developer LLBLGen Pro
EdDotNet
User
Posts: 31
Joined: 30-Mar-2005
# Posted on: 17-Apr-2006 21:07:16   

Otis wrote:

You can redirect the trace info to any destination you want. Just write a little tracelistener or let log4net listen to your trace output, though you can for example redirect the trace output to a file, see the petshop project example on our website for an example of this (web.config file).

Otis John sent me a great sample to work with. I would recommend putting the SHIP Templates back up on the 3rd party pages.

Also, I am not sure how to just write a little tracelistner that will output to ASP.NET in .NET 1.1 . I don't think its possible

thanks ed

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 17-Apr-2006 21:27:05   

EdDotNet wrote:

Otis wrote:

You can redirect the trace info to any destination you want. Just write a little tracelistener or let log4net listen to your trace output, though you can for example redirect the trace output to a file, see the petshop project example on our website for an example of this (web.config file).

Otis John sent me a great sample to work with. I would recommend putting the SHIP Templates back up on the 3rd party pages.

There's no need to, you can redirect/trace any SQL generated with a simple tracelistener. Write one yourself OR use one of the build in tracelisteners.

The templates you refer to aren't in the 3rd party section anymore because htey're completely obsolete. The code in there either is now doable with tracelisteners (recommended) OR you can derive a class from DataAccessdapter and override OnSave, OnSaveComplete etc. and grab the sql there.

Also, I am not sure how to just write a little tracelistner that will output to ASP.NET in .NET 1.1 . I don't think its possible

Sure it's possible, see the .NET documentation on trace listeners (MSDN). Though .net comes already with trace listeners for writing to file, stdout or eventlog. The tracing is done by .NET, it's independent of asp.net.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 1255
Joined: 10-Mar-2006
# Posted on: 26-Jul-2006 05:01:13   

Also, I have been using this:

http://www.sysinternals.com/Utilities/DebugView.html

With this you can view all SQL in a seperate program outside of Visual Studio. You can also connect it to any networked machine to view the SQL - although I have not tried that yet.

Let me know!