Get log
Retrieves server log data (with logging to memory enabled)
- Parameters
- Advanced call ?
Function GetLog(Val ServerObject, Val AsString = False, Val EventCount = 100) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| ServerObject | - | Arbitrary | ✔ | Object of running server component |
| 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
LaunchPort = 9877;
LogFile = GetTempFileName("txt");
LoggingSettings = OPI_TCP.GetLoggingSettings(True, 100, LogFile);
ServerObject = OPI_TCP.StartServer(LaunchPort, , LoggingSettings);
// Connect to running server
ConnectionAddress = "127.0.0.1:9877";
ClientObject = OPI_TCP.CreateConnection(ConnectionAddress);
If Not OPI_TCP.IsClientObject(ClientObject) Then
Raise OPI_Tools.JSONString(ClientObject);
EndIf;
Result = OPI_TCP.GetLog(ServerObject);
Result
{
"logs": [
"[2026-05-02 11:05:53.665] Binding to port 9877...",
"[2026-05-02 11:05:53.666] Successfully bound to port 9877",
"[2026-05-02 11:05:53.666] Listener task started",
"[2026-05-02 11:05:53.666] New connection accepted: bb4d5228-36fa-4e79-8387-a5e4bbd6b101 from 127.0.0..."
],
"result": true,
"returned": 4,
"total": 4
}