[Catalyst] How to show SQL in apache error_log?

John Napiorkowski jjn1056 at yahoo.com
Tue Jun 12 14:41:57 GMT 2007


--- Cookie <xiaoquqi at gmail.com> wrote:

> It seems useless.The apache error_log still don't
> output the sql.
> Thanks for your reponse.
> 
> 
> 
> Date: Mon, 11 Jun 2007 09:41:04 +0300
> From: "Octavian Rasnita" <orasnita at gmail.com>
> Subject: Re: [Catalyst] How to show SQL in apache
> error_log?
> To: "The elegant MVC web framework"
> <catalyst at lists.rawmode.org>
> Message-ID:
> <001f01c7abf3$80f5bf20$251c320a at octavian>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> You can put
> 
> $ENV{DBIC_TRACE}++;
> 
> in MyApp.pm
> 
> Octavian
> 
>  ----- Original Message ----- =
> 
>  From: Cookie =
> 
>  To: catalyst at lists.rawmode.org =
> 
>  Sent: Monday, June 11, 2007 7:01 AM
>  Subject: [Catalyst] How to show SQL in apache
> error_log?
> 
> 
>  As we know,if we use export DBIC_TRACE=3D1 and then
> we run the myapp_serv=
> er.pl,we can see the sql from the stander output.
>  I want to show the sql in the apache error_log.I
> modify the httpd.conf fi=
> le like this:
>  setenv DBIC_TRACE 1
>  But it seems useless.How can solve this problem?
>  Thanks.

If you are using DBIx::Class, you can enable debugging
mode, which output the SQL generated.  Also you can
enable DBI trace levels like so:

$schema->storage->debug(1);
$schema->storage->dbh->trace($x);

Where $x is range 1..15.  See:

http://search.cpan.org/~timb/DBI-1.56/DBI.pm#TRACING

For more.  Don't make the number too big or your logs
will explode.

I guess this all goes to STDOUT, but not sure what
Apache will do with that.  I don't have a lot of
experience with it because I usually log to a database
with log4perl for my webapps.  But give it a try.  You
might have to tweak the apache log configuration.  If
you are running the app in a virtual host you can
create a custom log handler just for it, so it's not
mixed up with your other hosts.

--john



 
____________________________________________________________________________________
Expecting? Get great news right away with email Auto-Check. 
Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html 



More information about the Catalyst mailing list