Go to: Synopsis. Return value. Flags. Python examples.

Synopsis

commandLogging([historySize=uint], [logCommands=boolean], [logFile=string], [recordCommands=boolean], [resetLogFile=boolean])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

commandLogging is undoable, queryable, and NOT editable.

This command controls logging of Maya commands, in memory and on disk.

Note that if commands are logged in memory, they will be available to the crash reporter and appear in crash logs.

Return value

None

In query mode, return type is based on queried flag.

Flags

historySize, logCommands, logFile, recordCommands, resetLogFile
Long name (short name) Argument types Properties
historySize(hs) uint createquery
Sets the number of entries in the in-memory command history.
logCommands(lc) boolean createquery
Enables or disables the on-disk logging of commands.
logFile(lf) string createquery
Sets the filename to use for the on-disk log. If logging is active, the current file will be closed before the new one is opened.
recordCommands(rc) boolean createquery
Enables or disables the in-memory logging of commands.
resetLogFile(rl) boolean createquery
Reset the log filename to the default ('mayaCommandLog.txt' in the application folder, alongside 'Maya.env' and the default projects folder).

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

# Set the number of commands logged in memory to 20
#
cmds.commandLogging( historySize=20 )

# Query the number of commands being logged in memory
#
cmds.commandLogging( q=True, historySize=True )
# Result: 20

# Query the log file location
#
cmds.commandLogging( q=True, logFile=True )
# Result: C:/Users/foobar/Documents/maya/mayaCommandLog.txt

# Change the log file location
#
cmds.commandLogging( logFile='C:/temp/log.txt' )

# Reset the log file to default
#
cmds.commandLogging( resetLogFile=True )