Ticket #767 (closed enhancement: invalid)
configurable verbosity during test runs
| Reported by: | Paul Winkler <pw@…> | Owned by: | andrew |
|---|---|---|---|
| Priority: | major | Milestone: | 1.0 |
| Component: | commands | Version: | 0.7.3 |
| Keywords: | Cc: |
Description
When running django-admin.py test, with SOUTH_TESTS_MIGRATE=True, South spews a ton of DEBUG information to the console. It dwarfs the actual test output and makes it hard to read.
I would really like a way to turn that off.
It doesn't seem to respect django-admin.py test -v 0
Perhaps a setting like SOUTH_TESTS_VERBOSITY?
Attachments
Change History
comment:2 Changed 2 years ago by andrew
- Status changed from new to assigned
- Milestone set to 1.0
Well, South uses its own logger, called "south" - have you tried setting the output level on that to INFO?
Additionally, -v 0 will be quiet only if you've not configured logging output yourself, otherwise it's up to you to get the config right :)
comment:3 Changed 2 years ago by Paul Winkler <pw@…>
I've traced this down to a surprising (to me) behavior of logging.basicConfig(level=...).
It sets the root logger's level, creates a default handler, and does not set that handler's level.
When a child logger logs a message, it checks the child logger's effective level (in this case DEBUG, because south sets its own logger's level to DEBUG); then when handlers are inherited from parent loggers, it is the handlers' level that matters, not the parent logger's level. So basicConfig(level=INFO) will allow all loggers other than the root logger to log at any level. I never realized that before. :-(
Given that, I do think it's a bit unusual that south sets its own logger's level to DEBUG at import time. Wny do you want DEBUG on by default? It's also surprising because if I call logging.getLogger('south').setLevel(n), it has no effect unless I import south first.
(I still don't understand why replacing south's NullHandler? implementation with the one from python 2.7 has the effect it does; AFAICT it shouldn't make any difference.)

Two things I've discovered:
1) The problem only happens if I've got a handler set up on the root logger.
For example, this triggers the problem (even though the level is set to INFO):
import logging logging.basicConfig(level=logging.INFO, format="%(asctime)-15s %(levelname)-8s %(message)s")2) I don't quite understand why, but copying this method from python 2.7's NullHandler? into South's NullHandler? fixes the problem:
def handle(self, record): pass