20.3 DBI Debug Techniques
For example, if you use Apache::DBI, modify your httpd.conf file with:
PerlSetEnv DBI_TRACE "3=~/tmp/dbitrace.log" PerlModule Apache::DBI
Replace 3 with the trace level you want. The traces from each request will be appended to /tmp/dbitrace.log. Note that the logs will probably be interleaved if requests are processed concurrently.
Within your code, you can control trace generation with the trace( ) method:
DBI->trace($trace_level) DBI->trace($trace_level, $trace_filename)
DBI trace information can be enabled for all handles using this DBI class method. To enable trace information for a specific handle, use the similar $dbh->trace method.
Using the trace option with a $dbh or $sth handle is useful to limit the trace information to the specific bit of code that you are debugging.
The trace levels are: