|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations > Logging & Security - Logging and access control > MCP Commands - Logging & Security |
MiniRobot Language (MRL) - MCP Logging & Security Commands
MCP.SetLogToFile
Enable or Disable File Logging
Purpose
The MCP.SetLogToFile command controls whether log messages are written to a file on disk. File logging provides persistent records of server activity that can be reviewed later for auditing, debugging, or analysis purposes.
When enabled, log messages are appended to the configured log file. The log file location and rotation settings are typically configured in the MCP server configuration.
Syntax
MCP.SetLogToFile|$$ENABLED
Parameters
$$ENABLED - Enable or disable file logging. Valid values: 1, 0, TRUE, FALSE, ON, OFF (case-insensitive).
Return Value
OK - File logging setting was updated
ERROR - Invalid parameter value
Examples
' Example 1: Enable file logging
MCP.SetLogToFile|1
' Example 2: Disable file logging
MCP.SetLogToFile|0
' Example 3: Enable file logging with TRUE keyword
MCP.SetLogToFile|TRUE
' Example 4: Disable with OFF keyword
MCP.SetLogToFile|OFF
Remarks
File logging is essential for production environments where log history needs to be preserved. The log files can be analyzed for troubleshooting, performance monitoring, and security auditing.
The default log file location and rotation policy depend on the MCP server configuration. Use MCP.GetRetentionTime and MCP.SetRetentionTime to manage log file retention.
Error Conditions
The command will fail with a parameter error if:
• The enabled parameter is missing
• An invalid value is specified (not 1, 0, TRUE, FALSE, ON, or OFF)
See also:
• MCP.SetLogLevel - Set Logging Level
• MCP.SetLogToConsole - Set Console Logging
• MCP.GetRetentionTime - Get Retention Time