MCP Commands - Logging & Security

<< 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

MCP.SetLogToConsole - Set Console Logging

PreviousTopNext


MiniRobot Language (MRL) - MCP Logging & Security Commands

 

MCP.SetLogToConsole

Enable or Disable Console Logging

 

Purpose

 

The MCP.SetLogToConsole command controls whether log messages are output to the console (stdout/terminal). This is useful for real-time monitoring during development or debugging sessions.

 

Console logging can be enabled independently of file logging. When both are enabled, log messages are written to both destinations simultaneously.

 

Syntax

 

MCP.SetLogToConsole|$$ENABLED

 

Parameters

 

$$ENABLED - Enable or disable console logging. Valid values: 1, 0, TRUE, FALSE, ON, OFF (case-insensitive).

 

Return Value

 

OK - Console logging setting was updated

ERROR - Invalid parameter value

 

Examples

 

' Example 1: Enable console logging for debugging

MCP.SetLogToConsole|1

 

' Example 2: Disable console logging

MCP.SetLogToConsole|0

 

' Example 3: Using TRUE/FALSE keywords

MCP.SetLogToConsole|TRUE

 

' Example 4: Using ON/OFF keywords

MCP.SetLogToConsole|ON

 

Remarks

 

Console logging is useful during development and troubleshooting but may impact performance in production environments. Consider disabling console logging and using file logging instead for high-throughput scenarios.

 

When the MCP server is running as a background service or without a terminal, console output may be discarded or redirected. In such cases, file logging is recommended.

 

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.SetLogToFile - Set File Logging

MCP.GetRetentionTime - Get Retention Time