Skip to content

Commit

Permalink
general: Added exc_info flag to error log messages
Browse files Browse the repository at this point in the history
Signed-off-by: Joe MacMahon <joe.macmahon@cern.ch>
  • Loading branch information
Joe MacMahon committed Jan 6, 2015
1 parent 0f4a702 commit 4f1d423
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions lumberjack/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ def _flush(self):

try:
self.bulk(self.elasticsearch, queue)
except TransportError as exception:
except TransportError:
self.logger.error('Error in flushing queue. Falling back to file.',
exc_info=exception)
exc_info=True)
json_lines = map(lambda doc: dumps(doc) + '\n', queue)
with open(self.config['fallback_log_file'], 'a') as log_file:
for line in json_lines:
Expand Down Expand Up @@ -121,7 +121,8 @@ def run(self):
traceback.print_exc(exc)
except Exception as exc:
self.logger.error(
'Action queue thread terminated unexpectedly.')
'Action queue thread terminated unexpectedly.',
exc_info=True)
self.last_exception = exc
caught_exception = True

Expand Down
6 changes: 4 additions & 2 deletions lumberjack/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ def _update_index_templates(self):
)
except TransportError:
logging.getLogger(__name__).warning(
'Error putting new template in Elasticsearch.')
'Error putting new template in Elasticsearch.',
exc_info=True)

# Try to update existing things.
for (doc_type, mapping) in mappings.items():
Expand All @@ -101,7 +102,8 @@ def _update_index_templates(self):
logging.getLogger(__name__).warning(
'There was an error putting the new mapping on some ' +
'indices. If you try to log new data to these, you ' +
'will see errors.')
'will see errors.',
exc_info=True)

def _build_mappings(self):
"""Parse the schemas into Elasticsearch mappings."""
Expand Down

0 comments on commit 4f1d423

Please sign in to comment.