summaryrefslogtreecommitdiff
path: root/python/skytools/scripting.py
diff options
context:
space:
mode:
authorMarko Kreen2009-11-03 12:28:27 +0000
committerMarko Kreen2009-11-03 12:43:44 +0000
commit2293f7843ebf9a5222edf4d980785983c72187b1 (patch)
tree8d30280b010933e13735c77f07304474c93235fd /python/skytools/scripting.py
parent9716946231fd10246ad73955ec930ea0cffa45f4 (diff)
DBScript: use log.exception also for psycopg errors
Diffstat (limited to 'python/skytools/scripting.py')
-rw-r--r--python/skytools/scripting.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/python/skytools/scripting.py b/python/skytools/scripting.py
index 57401773..49be0fcc 100644
--- a/python/skytools/scripting.py
+++ b/python/skytools/scripting.py
@@ -643,9 +643,11 @@ class DBScript(object):
cname = d.cursor.connection.my_name
dsn = d.cursor.connection.dsn
sql = d.cursor.query
+ if len(sql) > 200: # avoid logging londiste huge batched queries
+ sql = sql[:60] + " ..."
emsg = str(d).strip()
- self.log.error("Job %s got error on connection '%s': %s" % (
- self.job_name, cname, emsg))
+ self.log.exception("Job %s got error on connection '%s': %s. Query: %s" % (
+ self.job_name, cname, emsg, sql))
else:
n = "psycopg2.%s" % d.__class__.__name__
emsg = str(d).rstrip()