commit/galaxy-central: james_taylor: logging: If sentry is configured attach to the root logger no matter how logging was originally configured
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/3720c0455a43/ changeset: 3720c0455a43 user: james_taylor date: 2013-02-05 00:07:04 summary: logging: If sentry is configured attach to the root logger no matter how logging was originally configured affected #: 1 file diff -r 0856c4a75c92c56f54028f72502ce0ceb55b2e11 -r 3720c0455a436c9812d8ccb8577fd042c59b2048 lib/galaxy/config.py --- a/lib/galaxy/config.py +++ b/lib/galaxy/config.py @@ -401,36 +401,34 @@ """ Allow some basic logging configuration to be read from ini file. """ - # PasteScript will have already configured the logger if the appropriate - # sections were found in the config file, so we do nothing if the - # config has a loggers section, otherwise we do some simple setup - # using the 'log_*' values from the config. - if config.global_conf_parser.has_section( "loggers" ): - return - 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 ) + # PasteScript will have already configured the logger if the + # 'loggers' section was found in the config file, otherwise we do + # some simple setup using the 'log_*' values from the config. + if not config.global_conf_parser.has_section( "loggers" ): + 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 ) ) + # 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 ) # If sentry is configured, also log to it if config.sentry_dsn: pkg_resources.require( "raven" ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket