Get log
Retrieves server log data (with logging to memory enabled)
- Parameters
- Advanced call ?
Function GetLog(Val AddInObject, Val AsString = False, Val EventCount = 100) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| AddInObject | - | Arbitrary | ✔ | Server or client component object |
| AsString | - | Boolean | ✖ | True > returns log as a single string, False > as an array |
| EventCount | - | Number | ✖ | Number of recent events to retrieve. 0 > no limits |
Returns
String, Map Of KeyAndValue - Log as a string or a map with the full execution result
This method has no additional advanced call parameters.
Caution
NOCLI: this method is not available in CLI version
1C:Enterprise/OneScript code example
// Server start
LaunchPort = 9894;
LogFile = GetTempFileName("txt");
LoggingSettings = OPI_WebSocket.GetLoggingSettings(True, 100, LogFile);
ServerObject = OPI_WebSocket.StartServer(LaunchPort, , LoggingSettings);
// Client connect to server
ConnectionAddress = "ws://127.0.0.1:9894";
ClientObject = OPI_WebSocket.CreateConnection(ConnectionAddress);
If Not OPI_WebSocket.IsClientObject(ClientObject) Then
Raise OPI_Tools.JSONString(ClientObject);
EndIf;
// Server log retrieval
Result = OPI_WebSocket.GetLog(ServerObject);
Result
{
"logs": [
"[2026-05-26 15:38:56.437] Starting WebSocket server on port 9894 with config: WebSocketServerConfig ...",
"[2026-05-26 15:38:56.438] Adding WebSocket route: /",
"[2026-05-26 15:38:56.439] WebSocket server listening on 0.0.0.0:9894",
"[2026-05-26 15:38:56.441] Connection added: 4cf9b734-46a0-42a4-96a9-0e5569d40ca7",
"[2026-05-26 15:38:56.441] WebSocket connected: 4cf9b734-46a0-42a4-96a9-0e5569d40ca7"
],
"result": true,
"returned": 5,
"total": 5
}