Skip to main content

Get log

Retrieves connection log data (when in-memory logging is enabled)

Function GetLog(Val Connection, Val AsString = False, Val EventCount = 100) Export

ParameterCLI optionTypeRequiredDescription
Connection-ArbitraryAddIn object with open connection
AsString-BooleanTrue > returns log as a single string, False > as an array
EventCount-NumberNumber 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

Caution

NOCLI: this method is not available in CLI version

1C:Enterprise/OneScript code example
LogFile = GetTempFileName("txt");
LoggingSettings = OPI_GRPC.GetLoggingSettings(True, 100, LogFile);

Address = "https://grpcb.in:9001";

Proto1 = "https://hut.openintegrations.dev/test_data/grpcbin_with_import.proto";
Proto2 = "https://hut.openintegrations.dev/test_data/mt.proto";

Scheme = New Map;
Scheme.Insert("main.proto" , Proto1);
Scheme.Insert("my_types.proto", Proto2);

Parameters = OPI_GRPC.GetConnectionParameters(Address, Scheme);
Tls = OPI_GRPC.GetTlsSettings(True);

Connection = OPI_GRPC.CreateConnection(Parameters, Tls, LoggingSettings);

If Not OPI_GRPC.IsConnector(Connection) Then
Raise OPI_Tools.JSONString(Connection);
EndIf;

Service = "grpcbin.GRPCBin";
Method = "DummyUnary";

Result = OPI_GRPC.ExecuteMethod(Connection, Service, Method);

Result = OPI_GRPC.GetLog(Connection);
Result
{
"logs": [
"[2026-05-26 15:43:51.750] Connecting to gRPC server https://grpcb.in:9001",
"[2026-05-26 15:43:51.832] Connected to gRPC server",
"[2026-05-26 15:43:51.866] Call grpcbin.GRPCBin/DummyUnary"
],
"result": true,
"returned": 3,
"total": 3
}