Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log exception and error level output at debug #265

Merged
merged 1 commit into from
Jan 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dbt/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def safe_execute_model(self, data):
error = "Error executing {filepath}\n{error}".format(
filepath=model['build_path'], error=str(e).strip())
status = "ERROR"
logger.exception(error)
logger.debug(error)
if type(e) == psycopg2.InternalError and \
ABORTED_TRANSACTION_STRING == e.diag.message_primary:
return RunModelResult(
Expand All @@ -444,7 +444,7 @@ def safe_execute_model(self, data):
error = ("Unhandled error while executing {filepath}\n{error}"
.format(
filepath=model['build_path'], error=str(e).strip()))
logger.exception(error)
logger.debug(error)
raise e

execution_time = time.time() - start_time
Expand Down
6 changes: 3 additions & 3 deletions dbt/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def execute(self, sql):
return cursor.statusmessage
except Exception as e:
self.target.rollback()
logger.exception("Error running SQL: %s", sql)
logger.debug("Error running SQL: %s", sql)
logger.debug("rolling back connection")
raise e

Expand All @@ -170,7 +170,7 @@ def execute_and_fetch(self, sql):
return data
except Exception as e:
self.target.rollback()
logger.exception("Error running SQL: %s", sql)
logger.debug("Error running SQL: %s", sql)
logger.debug("rolling back connection")
raise e

Expand Down Expand Up @@ -207,7 +207,7 @@ def execute_without_auto_commit(self, sql, handle=None):
return handle, cursor.statusmessage
except Exception as e:
self.target.rollback()
logger.exception("Error running SQL: %s", sql)
logger.debug("Error running SQL: %s", sql)
logger.debug("rolling back connection")
raise e
finally:
Expand Down
8 changes: 4 additions & 4 deletions dbt/schema_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,18 @@ def execute_query(self, model, sql):
"SQL status: %s in %d seconds",
cursor.statusmessage, post-pre)
except psycopg2.ProgrammingError as e:
logger.exception('programming error: %s', sql)
logger.debug('programming error: %s', sql)
return e.diag.message_primary
except Exception as e:
logger.exception(
logger.debug(
'encountered exception while running: %s', sql)
e.model = model
raise e

result = cursor.fetchone()
if len(result) != 1:
logger.error("SQL: %s", sql)
logger.error("RESULT: %s", result)
logger.debug("SQL: %s", sql)
logger.debug("RESULT: %s", result)
raise RuntimeError(
"Unexpected validation result. Expected 1 record, "
"got {}".format(len(result)))
Expand Down
2 changes: 1 addition & 1 deletion dbt/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def track(*args, **kwargs):
try:
tracker.track_struct_event(*args, **kwargs)
except Exception as e:
logger.exception(
logger.debug(
"An error was encountered while trying to send an event"
)

Expand Down