django-nose icon indicating copy to clipboard operation
django-nose copied to clipboard

LogCapture defaults to DEBUG and changes all output during testing.

Open rrauenza opened this issue 11 years ago • 1 comments

I'm not sure what the intended behavior is. One problem is django nose seems to output all logging commands to the console during test. I need to find a fix for that as well.

But what I found is when I upgraded nose, LogCapture sets the default logging level to 0 at the root logger. Is this the intended behavior? Or should the logcapture level be only set for the specific logcapture handler?

(relevant code:

/perfcat/pcat/virtualenv/lib/python2.7/site-packages/nose/plugins/logcapture.py(195)setupLoghandler() 194 loglevel = getattr(self, "loglevel", "NOTSET") --> 195 root_logger.setLevel(getattr(logging, loglevel)) 196 )

Before:

ipdb> import logging_tree
ipdb> logging_tree.printout()
<--""
   Level WARNING
   Handler Stream <open file '<stderr>', mode 'w' at 0x7f290ef00270>
   Handler <nose.plugins.logcapture.MyMemoryHandler object at 0x27f7e50>
   |
   o<--"celery"
   |   Handler <kombu.log.NullHandler object at 0xc35950>
   |   |
   |   o<--"celery.task"
   |       Handler <kombu.log.NullHandler object at 0xc35ad0>
   |
   o<--"django"
   |   Handler <logging.NullHandler object at 0x1693850>
   |   |
   |   o<--[django.db]
   |   |   |
   |   |   o<--"django.db.backends"
   |   |
   |   o<--"django.request"
   |       Level ERROR
   |       Handler <django.utils.log.AdminEmailHandler object at 0x1693950>
[...]

After:

ipdb> logging_tree.printout()
<--""
   Handler Stream <open file '<stderr>', mode 'w' at 0x7f290ef00270>
   Handler <nose.plugins.logcapture.MyMemoryHandler object at 0x27f7e50>
   |
   o<--"celery"
   |   Handler <kombu.log.NullHandler object at 0xc35950>
   |   |
   |   o<--"celery.task"
   |       Handler <kombu.log.NullHandler object at 0xc35ad0>
   |
   o<--"django"
[...]

rrauenza avatar Mar 14 '14 18:03 rrauenza

Might be same issue as #160

jwhitlock avatar Jul 02 '15 22:07 jwhitlock