Link to home
Start Free TrialLog in
Avatar of dorward
dorward

asked on

Transparent wrapper around DBI for debugging purposes

I have a large code base (which runs under mod_perl) to which I would like to add some debugging code.

I would like to be able to run a bit of code everytime DBI is used to connect, prepare or execute. How can I add this debugging code _without_ editing every call to those methods and _without_ editing the DBI module itself.
Avatar of kandura
kandura

DBI can generate debugging information itself:

set
    DBI->trace(2 => "/tmp/logfile");
somewhere near the top of your script.
Or set the environment variable
    DBI_PROFILE=2

See manuals for DBI::Profile and DBI::Trace.

(Found this at http://www.class-dbi.com/cgi-bin/wiki/index.cgi?SeeAllSQL)
ASKER CERTIFIED SOLUTION
Avatar of kandura
kandura

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial