DBI::ProfileDumper::Apache and mod_perl 2

DBI::ProfileDumper::Apache and mod_perl 2

am 10.09.2007 16:47:58 von Brett

G'day all

I'm trying to get DBI::ProfileDumper::Apache working under mod_perl 2
and am having no luck at all. I've followed the easy instructions as per
the doc and put into my httpd.conf's section:

PerlSetEnv DBI_PROFILE_APACHE_LOG_DIR /var/log/apache2
PerlSetEnv DBI_PROFILE 2/DBI::ProfileDumper::Apache
PerlOptions +GlobalRequest

I've also tried replacing PerlSetEnv with SetEnv in case that might help
and it doesn't. The symptom is that no dbi.prof files are created, and
no errors are logged to error_log. Apache 2 starts normally but no joy
with getting any Profile data out. I haven't tried ProfileDumper with
mod_perl 2 up until now but have enjoyed success previously with
mod_perl 1.

I've performed an strace of httpd and see it load the
DBI::ProfileDumper::Apache module when apache starts, but there is no
attempt to open any dbi.prof files to write to.

Does anyone have any suggestions how I can debug this further and figure
out why I cannot get it working? I am running Apache 2.2.3, mod_perl
2.0.2, Perl 5.8.8 and DBI 1.59 on a Debian Etch box. I was running
factory Apache 2, MySQL, DBI and DBD modules that weren't working, then
downloaded my own MySQL, DBI and DBD source packages, removed the
prebuilt ones and built my own with the same end result (still factory
Apache 2 though - yet to attempt my first Apache 2 compile from
scratch).

TIA for any assistance.
--
Brett Randall
InterPlanetary Solutions

Re: DBI::ProfileDumper::Apache and mod_perl 2

am 10.09.2007 19:57:25 von Tim.Bunce

On Tue, Sep 11, 2007 at 12:47:58AM +1000, Brett Randall wrote:
> G'day all
>
> I'm trying to get DBI::ProfileDumper::Apache working under mod_perl 2
> and am having no luck at all. I've followed the easy instructions as per
> the doc and put into my httpd.conf's section:
>
> PerlSetEnv DBI_PROFILE_APACHE_LOG_DIR /var/log/apache2
> PerlSetEnv DBI_PROFILE 2/DBI::ProfileDumper::Apache
> PerlOptions +GlobalRequest
>
> I've also tried replacing PerlSetEnv with SetEnv in case that might help
> and it doesn't. The symptom is that no dbi.prof files are created, and
> no errors are logged to error_log. Apache 2 starts normally but no joy
> with getting any Profile data out. I haven't tried ProfileDumper with
> mod_perl 2 up until now but have enjoyed success previously with
> mod_perl 1.
>
> I've performed an strace of httpd and see it load the
> DBI::ProfileDumper::Apache module when apache starts,

Assuming you don't explictly load DBI::ProfileDumper::Apache elsewhere
then that means the DBI_PROFILE env var is being recognised and processed.

It should then enable profiling for all driver loaded after the
env var is set. So be sure you're not explicitly loading the
driver, let DBI do that in a connect statement (or be sure to load it
after DBI_PROFILE has been set).

> but there is no attempt to open any dbi.prof files to write to.

The file gets written when the child process exits.

> Does anyone have any suggestions how I can debug this further and figure
> out why I cannot get it working?

Check the above. Then check $dbh->{Profile} is true.

(If you've still no joy I may be able to check a mod_perl2 setup in a
day or two.)

Tim.

> I am running Apache 2.2.3, mod_perl
> 2.0.2, Perl 5.8.8 and DBI 1.59 on a Debian Etch box. I was running
> factory Apache 2, MySQL, DBI and DBD modules that weren't working, then
> downloaded my own MySQL, DBI and DBD source packages, removed the
> prebuilt ones and built my own with the same end result (still factory
> Apache 2 though - yet to attempt my first Apache 2 compile from
> scratch).

Re: DBI::ProfileDumper::Apache and mod_perl 2

am 16.09.2007 00:34:04 von Brett

On Mon, 2007-09-10 at 18:57 +0100, Tim Bunce wrote:
> On Tue, Sep 11, 2007 at 12:47:58AM +1000, Brett Randall wrote:
> > Does anyone have any suggestions how I can debug this further and figure
> > out why I cannot get it working?
>
> Check the above. Then check $dbh->{Profile} is true.

Hi Tim

Thanks for your reply. I've set the script to tell me after a database
connection what is in $dbh->{Profile} and it is empty.

I haven't actually told you how I'm using mod_perl 2. In my apache.conf
file I have a virtual host. Inside that virtual host I define all my
mod_perl handlers with:

PerlModule ORS::Admin::Email::Admins

SetHandler perl-script
PerlResponseHandler ORS::Admin::Email::Admins


So I don't actually run scripts as such, I just have a lot of
PerlResponseHandlers for each Location. Will this affect anything to do
with DBI::ProfileDumper::Apache? Also I've grep'd through all my code
and I definitely don't load either the DBI::ProfileDumper::Apache module
or DBD::mysql module anywhere.

Thanks for any assistance you can give!
--
Brett Randall
InterPlanetary Solutions