From 752d05dedbc64987929926b43fc6dc765178ef73 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 30 Sep 2015 15:49:35 -0400 Subject: [PATCH] Add exception logging to the build manager Fixes #547 --- buildman/builder.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/buildman/builder.py b/buildman/builder.py index 8f1bb18c5..08f5f733a 100644 --- a/buildman/builder.py +++ b/buildman/builder.py @@ -2,6 +2,7 @@ import logging import os import features import time +import socket from app import app, userfiles as user_files, build_logs, dockerfile_build_queue @@ -10,6 +11,8 @@ from buildman.manager.ephemeral import EphemeralBuilderManager from buildman.server import BuilderServer from trollius import SSLContext +from raven.handlers.logging import SentryHandler +from raven.conf import setup_logging logger = logging.getLogger(__name__) @@ -77,4 +80,10 @@ if __name__ == '__main__': logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT) logging.getLogger('peewee').setLevel(logging.WARN) logging.getLogger('boto').setLevel(logging.WARN) + + if app.config.get('EXCEPTION_LOG_TYPE', 'FakeSentry') == 'Sentry': + buildman_name = '%s:buildman' % socket.gethostname() + setup_logging(SentryHandler(app.config.get('SENTRY_DSN', ''), name=buildman_name, + level=logging.ERROR)) + run_build_manager()