Name
trace
Synopsis
DBI->trace($trace_level) DBI->trace($trace_level, $trace_filename)
DBI
trace
information can be enabled for all handles using the
trace
DBI class method. To enable trace
information for a specific handle, use the similar
$h-
>trace
method described
elsewhere.
Trace levels are as follows:
- 0
Trace disabled.
- 1
Trace DBI method calls returning with results or errors.
- 2
Trace method entry with parameters and returning with results.
- 3
As above, adding some high-level information from the driver and some internal information from the DBI.
- 4
As above, adding more detailed information from the driver. Also includes DBI mutex information when using threaded Perl.
- 5 and above
As above, but with more and more obscure information.
Trace level 1 is best for a simple overview of what’s happening. Trace level 2 is a good choice for general purpose tracing. Levels 3 and above (up to 9) are best reserved for investigating a specific problem, when you need to see “inside” the driver and DBI.
The trace output is detailed and typically very useful. Much of the
trace output is formatted using the neat
function,
so strings may be edited and truncated.
Initially, trace output is written to STDERR
. If
$trace_filename
is specified, the file is opened
in append mode and all trace output (including that from other
handles) is redirected to that file. Further calls to
trace
without a $trace_filename
do not alter where the trace output is sent. If
$trace_filename
is undefined, then trace output is sent to ...
Get Programming the Perl DBI now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.