Discussion:
[Pyzo] Logging basic config does not work
j***@gmail.com
2017-10-16 11:07:17 UTC
Permalink
After a lot of digging, I found that for some reason Pyzo 4.4.2 using Python 3.6.3 are not working together regarding the logging library. This is the simple script I have used to confirm that Pyzo is the problem:

import logging
logging.basicConfig( level=logging.DEBUG )
logging.debug('DEBUG')
logging.info('INFO')
logging.warning('WARINING')

In Pyzo the output is:
WARNING:root:WARINING

Using the same python executable in the command line the output is:
DEBUG:root:DEBUG
INFO:root:INFO
WARNING:root:WARINING

This leads me to beleive Pyzo does something with logging, where a configuration is already made. When I change the script to the following ( by resetting the logger handlers ):

import logging
logging.getLogger('').handlers = []
logging.basicConfig( level=logging.DEBUG )
logging.debug('DEBUG')
logging.info('INFO')
logging.warning('WARINING')

both ways have the same result.

Is there any intended behavior of which I am not aware?
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Almar Klein
2017-10-30 09:24:20 UTC
Permalink
Hi,

Sorry for the late reply. Is this regarding running certain code in
Pyzo, or running Pyzo itself? Can you be more specific on what you were
expected and what you got instead?

What I can see now, is that Pyzo the IDE does use the logging module,
but it does grab stdout and stderr.  As for code running in Pyzo: the
kernel adds a handler to the root logger to facilitate post-mortem
debugging.

Regards,
  Almar
Post by j***@gmail.com
import logging
logging.basicConfig( level=logging.DEBUG )
logging.debug('DEBUG')
logging.info('INFO')
logging.warning('WARINING')
WARNING:root:WARINING
DEBUG:root:DEBUG
INFO:root:INFO
WARNING:root:WARINING
import logging
logging.getLogger('').handlers = []
logging.basicConfig( level=logging.DEBUG )
logging.debug('DEBUG')
logging.info('INFO')
logging.warning('WARINING')
both ways have the same result.
Is there any intended behavior of which I am not aware?
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...