details: http://www.bx.psu.edu/hg/galaxy/rev/30f4ab3cc266 changeset: 1500:30f4ab3cc266 user: James Taylor <james@jamestaylor.org> date: Wed Sep 10 09:58:29 2008 -0400 description: Allow complete logging configuration to be specified in the ini file, in which case this is used instead of the "log_level" and "log_format" keys under the app configuration. PasteScript actually handles this, so we just do nothing related to logging config if the ini file contains a "[loggers]" section. For example, you could add this to the end of your universe_wsgi.ini to include SQLAlchemy debugging and include the thread name with every log message. # Logger overrides [loggers] keys = root, sqlalchemy.engine, sqlalchemy.orm.unitofwork, paste.httpserver.ThreadPool [logger_root] level = DEBUG handlers = console [logger_sqlalchemy.engine] level = INFO handlers = console qualname = sqlalchemy.engine [logger_sqlalchemy.orm.unitofwork] level = DEBUG handlers = console qualname = sqlalchemy.orm.unitofwork [logger_paste.httpserver.ThreadPool] level = INFO handlers = console qualname = paste.httpserver.ThreadPool [handlers] keys = console [handler_console] class = StreamHandler args = (sys.stderr,) level = NOTSET formatter = generic [formatters] keys = generic [formatter_generic] format = %(threadName)s %(name)s %(levelname)s %(asctime)s %(message)s 1 file(s) affected in this change: lib/galaxy/config.py diffs (28 lines): diff -r f9d00dbefdec -r 30f4ab3cc266 lib/galaxy/config.py --- a/lib/galaxy/config.py Mon Sep 08 16:00:49 2008 -0400 +++ b/lib/galaxy/config.py Wed Sep 10 09:58:29 2008 -0400 @@ -64,9 +64,10 @@ self.bugs_email = kwargs.get( 'bugs_email', None ) self.blog_url = kwargs.get( 'blog_url', None ) self.screencasts_url = kwargs.get( 'screencasts_url', None ) - #Parse global_conf + # Parse global_conf and save the parser global_conf = kwargs.get( 'global_conf', None ) global_conf_parser = ConfigParser.ConfigParser() + self.global_conf_parser = global_conf_parser if global_conf and "__file__" in global_conf: global_conf_parser.read(global_conf['__file__']) #Store per-tool runner config @@ -118,6 +119,12 @@ Allow some basic logging configuration to be read from the cherrpy config. """ + # 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" )