logging.basicConfig is only run ONCE for the python session. It's an
application-level initialization of the logging module, so it shouldn't be
run more than once. After that, you'll need to change the log-level via the
loggers:

 

logger.setLevel(logging.DEBUG)

 

or via the streams attached to those loggers:

 

for handler in logger.handlers:

                handler.setLevel(logging.DEBUG)

 

 

pymel 0.9 uses and initializes the logging module, and allows
user-customization throught the pymel.conf file.

Also check out the Logging-Menu, which allow the logging module to be
administered through the UI:

 

import pymel.tools.loggingControl as loggingControl

loggingControl.initMenu()

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Sylvain Berger
Sent: Friday, October 09, 2009 7:45 AM
To: python_inside_maya
Subject: [Maya-Python] Re: python logging and maya

 

Finally I am not too sure how this works... I can get the debug message to
log sometimes... not too sure why yet.  There is something in the logging
concept that I am not getting.




On Fri, Oct 9, 2009 at 10:18 AM, sberger <[email protected]> wrote:


Hi, I have been experimenting with the python logging module... for
some reason the debug and info level of the logging are not printed in
Maya..

Here is a simple example:
import logging
def go():
   logging.basicConfig(level=logging.DEBUG)

   logger1 = logging.getLogger('package1.module1')

   logger1.debug('This is a debug message')
   logger1.info('This is an info message')
   logger1.warning('This is a warning message')
   logger1.error('This is an error message')
   logger1.critical('This is a critical error message')

go()

When executed in Maya I get this result:
# WARNING:package1.module1:This is a warning message
# ERROR:package1.module1:This is an error message
# CRITICAL:package1.module1:This is a critical error message

Where it should be:
DEBUG:package1.module1:This is a debug message
INFO:package1.module1:This is an info message
WARNING:package1.module1:This is a warning message
ERROR:package1.module1:This is an error message
CRITICAL:package1.module1:This is a critical error message


Anyone have any idea why that is?






-- 
"A pit would not be complete without a Freeman coming out of it."
The Vortigaunt



--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to