<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">SYNOPSIS

     use DBI;
     use Log::Any::For::DBI;
    
     # now all connect()'s, do()'s, prepare()'s are logged with Log::Any
     my $dbh = DBI-&gt;connect("dbi:...", $user, $pass);
     $dbh-&gt;do("INSERT INTO table VALUES (...)");

    Sample script and output:

     % TRACE=1 perl -MLog::Any::App -MDBI -MLog::Any::For::DBI \
       -e'$dbh=DBI-&gt;connect("dbi:SQLite:dbname=/tmp/tmp.db", "", "");
       $dbh-&gt;do("CREATE TABLE IF NOT EXISTS t (i INTEGER)");'
     [1] ---&gt; DBI::connect(['dbi:SQLite:dbname=/tmp/tmp.db','','********'])
     [5] &lt;--- DBI::connect() = [bless( {}, 'DBI::db' )]
     [5] ---&gt; DBI::db::do(['CREATE TABLE IF NOT EXISTS t (i INTEGER)'])
     [5] ---&gt; DBI::db::prepare(['CREATE TABLE IF NOT EXISTS t (i INTEGER)',undef])
     [5] &lt;--- DBI::db::prepare() = [bless( {}, 'DBI::st' )]
     [5] ---&gt; DBI::st::execute([])
     [5] &lt;--- DBI::st::execute() = ['0E0']
     [5] &lt;--- DBI::db::do()

    You can filter to log only certain methods by passing the method names
    as import arguments, for example:

     use Log::Any::For::DBI qw(prepare connect);

SEE ALSO

    Log::Any::For::Class

    DBIx::Log4perl, one of the inspirations for this module. With due
    respect to its author, I didn't like the approach of DBIx::Log4perl and
    its intricate links to DBI's internals. I'm sure DBIx::Log4perl is good
    at what it does, but currently I only need to log SQL statements.

</pre></body></html>