Commit ae145f2b authored by ale's avatar ale
Browse files

Move syslog setup code to main.py

parent 11ce8239
import functools
import json
import logging
import logging.handlers
import re
import urllib
import uuid
......@@ -212,15 +211,7 @@ def create_app(config_file=None, config={}):
app.config['ALLOWED_SERVICES'].append(
'%s/saml/' % app.config['SAML']['SSO_LOGIN_SERVER'].replace('.', r'\.'))
# Initialize the login service.
app.login_service = login_service.LoginService(app.config)
return app
def setup_syslog(level=logging.INFO):
root_logger = logging.getLogger()
root_logger.setLevel(level)
syslog_handler = logging.handlers.SysLogHandler(address='/dev/log')
syslog_handler.setFormatter(
logging.Formatter('sso_server: %(name)s: %(levelname)s %(message)s'))
root_logger.addHandler(syslog_handler)
......@@ -29,6 +29,7 @@ __version__ = '0.3'
import errno
import logging
import logging.handlers
import os
import optparse
import signal
......@@ -44,7 +45,12 @@ def setup_logging(opts):
if opts.logtostderr:
logging.basicConfig(level=level)
else:
application.setup_syslog(level)
root_logger = logging.getLogger()
root_logger.setLevel(level)
syslog_handler = logging.handlers.SysLogHandler(address='/dev/log')
syslog_handler.setFormatter(
logging.Formatter('sso_server: %(name)s: %(levelname)s %(message)s'))
root_logger.addHandler(syslog_handler)
def autodetect_fastcgi():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment