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:
- 0
-
Trace disabled
- 1
-
Trace DBI method calls returning with results
- 2
-
Trace method entry with parameters and exit with results
- 3
-
As above, adding some high-level information from the driver and also
adding some internal information from the DBI
- 4
-
As above, adding more detailed information from the driver and also
including DBI mutex information when using threaded Perl
- 5+
-
As above, but with more and more obscure information
| | |
20.2. Improving Performance | | 20.4. References |