Add exception logging to the build manager

Fixes #547
This commit is contained in:
Joseph Schorr 2015-09-30 15:49:35 -04:00
parent 6498e1fe87
commit 752d05dedb

View file

@ -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()