Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes reports app under py3 #9305

Merged
merged 1 commit into from Feb 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/galaxy/webapps/reports/app.py
Expand Up @@ -3,6 +3,7 @@
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
Expand All @@ -19,7 +20,7 @@ def __init__(self, **kwargs):
# 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:
Expand Down
32 changes: 0 additions & 32 deletions lib/galaxy/webapps/reports/config.py
Expand Up @@ -2,7 +2,6 @@
import logging
import os
import re
import sys

from galaxy.util import string_as_bool

Expand Down Expand Up @@ -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)