Merge pull request #9309 from dannon/backport-reports-py3-fix

[20.01] Backport reports config/py3 fix
This commit is contained in:
Nicola Soranzo
2020-02-04 15:42:22 +00:00
committed by GitHub
2 changed files with 2 additions and 33 deletions
+2 -1
View File
@@ -3,6 +3,7 @@ import sys
import time
import galaxy.model
from galaxy.config import configure_logging
from galaxy.security import idencoding
from galaxy.web_stack import application_stack_instance
from . import config
@@ -19,7 +20,7 @@ class UniverseApplication(object):
# Read config file and check for errors
self.config = config.Configuration(**kwargs)
self.config.check()
config.configure_logging(self.config)
configure_logging(self.config)
self.application_stack = application_stack_instance()
# Determine the database url
if self.config.database_connection:
-32
View File
@@ -2,7 +2,6 @@
import logging
import os
import re
import sys
from galaxy.util import string_as_bool
@@ -108,34 +107,3 @@ def get_database_engine_options(kwargs):
value = conversions[key](value)
rval[key] = value
return rval
def configure_logging(config):
"""
Allow some basic logging configuration to be read from the cherrpy
config.
"""
format = config.get("log_format", "%(name)s %(levelname)s %(asctime)s %(message)s")
level = logging._levelNames[config.get("log_level", "DEBUG")]
destination = config.get("log_destination", "stdout")
log.info("Logging at '%s' level to '%s'" % (level, destination))
# Get root logger
root = logging.getLogger()
# Set level
root.setLevel(level)
# Turn down paste httpserver logging
if level <= logging.DEBUG:
logging.getLogger("paste.httpserver.ThreadPool").setLevel(logging.WARN)
# Remove old handlers
for h in root.handlers[:]:
root.removeHandler(h)
# Create handler
if destination == "stdout":
handler = logging.StreamHandler(sys.stdout)
else:
handler = logging.FileHandler(destination)
# Create formatter
formatter = logging.Formatter(format)
# Hook everything up
handler.setFormatter(formatter)
root.addHandler(handler)