Adding exception logging to dbapi