ThreadedConnectionPool and Cherrypy

Joe Abbate <jma-ICVE9uepxrQgpMukQH3QewC/[email protected]> Thu, 24 Jun 2010 21:45:50 -0400
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
Hi,

I'm using psycopg2 2.0.14 and cherrypy 3.1.2.  I have been using 
SQLAlchemy to manage connections, but when I found out about 
ThreadedConnectionPool I decided to give it a try since I don't need the 
rest of SA.

I've got it working but there is an annoying side effect of using 
psycopg's pool.  CherryPy implements logging so it writes to stdout or 
to a designated log file messages like these:

[24/Jun/2010:21:37:05] ENGINE Bus STARTING
[24/Jun/2010:21:37:05] ENGINE Serving on 127.0.0.1:8080
[24/Jun/2010:21:37:05] ENGINE Creating the SQL database engine

However, psycopg2's pool.py implements its own logger so now everything 
in the log ends up duplicated:

[24/Jun/2010:21:38:58] ENGINE Bus STARTING
2010-06-24 21:38:58,900 INFO [24/Jun/2010:21:38:58] ENGINE Bus STARTING
[24/Jun/2010:21:38:59] ENGINE Serving on 127.0.0.1:8085
2010-06-24 21:38:59,105 INFO [24/Jun/2010:21:38:59] ENGINE Serving on 
127.0.0.1:8085
[24/Jun/2010:21:38:59] ENGINE Creating the SQL database engine
2010-06-24 21:38:59,106 INFO [24/Jun/2010:21:38:59] ENGINE Creating the 
SQL database engine

Not a big deal, but as I said it's annoying.  I'm wondering if there is 
some way to turn off psycopg2's logging.

TIA.

Joe