Search code examples
loggingnose

nose 1.3.4 and logging with custom handlers


I am trying to have different handlers for different subpackages of my project, however, when I add a console (i.e. StreamHandler to stdout), then due to some reason, the nose is not catching any of the logging output which is going to that handler.

I do not have any special nose configuration except that for every unit test I load the logger as logging.getLogger(__name__) and set the configuration of the logging via the logging.dictConfig.

So in short terms:

  • Expected behaviour: using --nologcapture should show all of the logging
  • Observed behaviour: there is no difference in whether I use --nologcapture or not

Let me know if you want more bagckground.


Solution

  • I would highly suggest using logging_tree to debug the structure of all the loggers. Just add from logging_tree import printout; printout() to see the logging structure right before the console printout that does not work.