Commit 7c6522ea authored by Dannon Baker's avatar Dannon Baker
Browse files

Fixes reports app under py3 by swapping to the more standard (modern...) log configuration function

parent bd96d8d3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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:
+0 −32
Original line number Diff line number Diff line
@@ -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)