On Wed, Nov 27, 2013 at 11:24:34AM +1100, Victor Hooi wrote:
Quite apart from your question but if you do this:
> def get_pg_connection(logger_name, database_config):
...
> except psycopg2.OperationalError as e:
> logger.error('Error connecting to database {0[host]}:{0[port]}/{0[dbname]} - {1}'.format(database_config, e),
exc_info=True)
...
> except Exception as e:
> logger.error('Error - {}'.format(e), exc_info=True)
you will see UnicodeDecodeError from the logger
infrastructure as soon as the PostgreSQL error message
contains characters which don't fit the ASCII subset.
This will happen as soon as PostgreSQL is set to
a locale other then C or en_*
Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346