Yury,
First create a logging object.  If you are running this from the script
editor, you will need to set propagate = False so maya does not catch and
resend your message in the format you see above.  Also, I would recommend
the log handler provided by PyMel as it is already wired up to the correct
error/warning/info events.  It is already available in Maya 2011 or greater.

Try this:

import logging
import maya.utils

myLogger = logging.getLogger("MyLogger")
myLogger.propagate = False
handler = maya.utils.MayaGuiLogHandler()
handler.setLevel(logging.INFO)
formatter = logging.Formatter("%(asctime)s %(message)s")
handler.setFormatter(formatter)
myLogger.addHandler(handler)

myLogger.warning('is when this event was logged.')


Cheers,

-jesse
On Tue, Dec 6, 2011 at 5:48 PM, ynedelin <[email protected]> wrote:

> I got this from the python docs page
>
> if I run this in the script editor:
>
> import logging
> logging.basicConfig(format='%(asctime)s %(message)s')
> logging.warning('is when this event was logged.')
>
> I get this:
>
> # Warning: root : is when this event was logged. #
>
> How can I get the date to show in the script editor?
>
> 2010-12-12 11:41:42,612 is when this event was logged.
>
> Yury
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to