Ensure requests to the web server hit the file log too.

This commit is contained in:
Dave Page 2014-12-16 18:21:26 +00:00
parent 53389d6ee0
commit a0628f4a84

View File

@ -31,17 +31,22 @@ app = Flask(__name__, static_url_path='')
logging.addLevelName(25, 'SQL') logging.addLevelName(25, 'SQL')
app.logger.setLevel(logging.DEBUG) app.logger.setLevel(logging.DEBUG)
# We also need to update the handler on the webserver in order to see request
logger = logging.getLogger('werkzeug')
# File logging # File logging
fh = logging.FileHandler(config.LOG_FILE) fh = logging.FileHandler(config.LOG_FILE)
fh.setLevel(config.FILE_LOG_LEVEL) fh.setLevel(config.FILE_LOG_LEVEL)
fh.setFormatter(logging.Formatter(config.FILE_LOG_FORMAT)) fh.setFormatter(logging.Formatter(config.FILE_LOG_FORMAT))
app.logger.addHandler(fh) app.logger.addHandler(fh)
logger.addHandler(fh)
# Console logging # Console logging
ch = logging.StreamHandler() ch = logging.StreamHandler()
ch.setLevel(config.CONSOLE_LOG_LEVEL) ch.setLevel(config.CONSOLE_LOG_LEVEL)
ch.setFormatter(logging.Formatter(config.CONSOLE_LOG_FORMAT)) ch.setFormatter(logging.Formatter(config.CONSOLE_LOG_FORMAT))
app.logger.addHandler(ch) app.logger.addHandler(ch)
logger.addHandler(ch)
app.logger.debug('################################################################################') app.logger.debug('################################################################################')
app.logger.debug('Starting pgAdmin 4...') app.logger.debug('Starting pgAdmin 4...')