Error logging
 
 
 

As well as using the MStatus class, you can check for failures in API methods using error logging.

To enable and disable error logging

  1. Do one of the following:
    • From MEL, use the -errlog flag of the openMayaPref command.
    • From the plug-in, use the methods MGlobal::startErrorLogging() and MGlobal::stopErrorLogging().

Once you enable error logging, Maya creates a log file and each time an API method fails, Maya writes a description of the error to the file along with a mini stack trace that shows where the call to the routine was made.

The default name of this file is OpenMayaErrorLog located in the current directory. This can be changed, however, by calling:

MGlobal::setErrorLogPathName().
TipPlug-ins can also use the method, MGlobal::doErrorLogEntry() to add their own messages to the error log.