Nuke replaces `sys.stdout` with its own stream object that writes to the script 
editor. Thus, by the time your logging code comes along and creates its output 
handler(s), it’s binding to the replacement instead. Python always stores the 
original stream at sys.__stdout__ though, so you can either bind your stream 
handler to that (which will be enough to write to the terminal), or write your 
own basic handler subclass to do whatever you want (e.g. write to both).

-Nathan



From: Frank Rueter|OHUfx 
Sent: Sunday, June 22, 2014 4:22 PM
To: Nuke Python discussion 
Subject: [Nuke-python] log levels in nuke

Hi all,

I re-jigged some of my existing code to use the logging module by putting 
something like this into the heads of my modules:
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG, format='||%(name)s | %(module)s | 
%(funcName)s | %(levelname)s || %(message)s')


However, when run in Nuke, nothing is printed to the terminal, even when I try 
to set the log level to debug in the menu.py as well.
What am I missing?

Cheers,
frank


-- 
     vfx compositing | workflow customisation and consulting  



--------------------------------------------------------------------------------
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to