Name
trace
Synopsis
$h->trace($trace_level); $h->trace($trace_level, $trace_filename);
DBI trace
information can be enabled for a specific handle (and any future
children of that handle) by setting the trace level using the
trace
method.
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. Set
$trace_level
to 0
to disable
the trace.
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, then 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 STDERR
and the
previous trace file is closed.
See also the DBI-
>trace
method for information about the DBI_TRACE
environment variable.
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.