Nosetests logcapture with Pylons not working
I'm writing unit tests for a Pylons web application I'm developing. I would like to see the logs.debug|info|etc when I run my tests and an error occurs, but right now it just captures the print() statements.
to run a test, I do the following:
nosetests --with-pylons=test.ini --debug-log=test.log --verbosity=3
The result is that it won't output anything in the log file or in the console.
test.ini is using development.ini, which contains the following loggers code:
[loggers]
keys = root, routes, myapp, sqlalchemy
[handlers]
keys = console, file
[formatters]
keys = generic
[logger_root]
level = DEBUG
handlers = console, file
[logger_routes]
level = INFO
handlers =
qualname = routes.middleware
[logger_myapp]
level = DEBUG
handlers =
qualname = myapp
[logger_sqlalchemy]
level = INFO
handlers =
qualname = sqlalchemy.engine
[handler_console]
class = StreamHand开发者_如何学运维ler
args = (sys.stdout, )
level = DEBUG
formatter = generic
[handler_file]
class = FileHandler
args = ('application.log', 'a')
level = DEBUG
formatter = generic
[formatter_generic]
format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] [%(threadName)s] %(message)s
datefmt = %H:%M:%S
Logging works fine when I start the whole application.
精彩评论