To understand what's happening here you need to know a little about how PEAR:😃B works. Locate DB.php and take a look inside.
DB works on a selection of subclasses which handle the specifics of different databases. The static connect method of DB doesn't just return an instance of DB it analyzes the dsn (DB.php:520) and from that determines which of it's subclasses to instantiate (DB.php:547). So when you connect with
$db =& DB::connect( 'mysql://something@localhost/db' );
You're actually getting an instance of DB_mysql (a subclass of D😎 returned.
In order to have you're logging take place you're going to tackle the problem quite differently. Now would be a good time to go out and buy a design patterns book, or check out www.phppatterns.com.
One particular design pattern concerns itself with this problem almost exactly, it's called Decorator. Now, in your case you want to "decorate" your DB (or subclass thereof) object with logging capabilities. Your decorator class needs to hold the same interface as DB's database specific subclasses do (basically everything except for it's static methods) and then you would instantiate it like this.
$db =& new DBLogger( DB::connect( 'mysql://something@localhost' );
Within each of the methods which you choose to implement in DBLogger it just does what it needs to and then sends it off to the DB object (which it has stored internally as a parameter).