import logging
_logger = logging.getLogger('myLogger')
for handler in _logger.handlers:
_logger.removeHandler(handler)
ch = logging.StreamHandler()
ch.setLevel(logging.INFO)
formatter = logging.Formatter('%(name)s:%(levelname)s: %(message)s')
ch.setFormatter(formatter)
_logger.addHandler(ch)
_logger.propagate=0
_logger.info('yeah')
# myLogger:INFO: yeahpropagate to off already, where does the '#' come from when I use _logger in maya 2015?import sys
# Maya installs this one so it goes to Script Editor
sys.stderr.write("stderr\n")
# The original one that Maya saves
sys.__stderr__.write("__stderr__\n")
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c6cf48a7-6e51-4060-b606-d3ab4999a300%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
ch = logging.StreamHandler(sys.stdout)
The '#' goes away.On Sun, Jul 17, 2016 at 5:38 AM oglop <ogl...@gmail.com> wrote:import logging
_logger = logging.getLogger('myLogger')
for handler in _logger.handlers:
_logger.removeHandler(handler)
ch = logging.StreamHandler()
ch.setLevel(logging.INFO)
formatter = logging.Formatter('%(name)s:%(levelname)s: %(message)s')
ch.setFormatter(formatter)
_logger.addHandler(ch)
_logger.propagate=0
_logger.info('yeah')
# myLogger:INFO: yeah
I have setpropagate to off already, where does the '#' come from when I use _logger in maya 2015?It is because your logging is going to stderr, and Maya assigns a custom stderr and hides the original one:import sys # Maya installs this one so it goes to Script Editor sys.stderr.write("stderr\n") # The original one that Maya saves sys.__stderr__.write("__stderr__\n")Justin
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.