From 0a53819a4fa41d22e878c4cd3c4d95330f583deb Mon Sep 17 00:00:00 2001 From: hiddenpath Date: Sat, 3 May 2025 01:51:57 +0300 Subject: YT-24500: Introduce structured logging commit_hash:e6ea4db1e3a66694223008fec3b5064a4d58a8e1 --- yt/cpp/mapreduce/client/init.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'yt/cpp/mapreduce/client/init.cpp') diff --git a/yt/cpp/mapreduce/client/init.cpp b/yt/cpp/mapreduce/client/init.cpp index 2a4e8730309..9e49f2df685 100644 --- a/yt/cpp/mapreduce/client/init.cpp +++ b/yt/cpp/mapreduce/client/init.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -184,10 +185,17 @@ void CommonInitialize(TGuard& g) if (!NLogging::TLogManager::Get()->IsDefaultConfigured()) { return; } + auto coreLoggingConfig = NLogging::TLogManagerConfig::CreateStderrLogger(ToCoreLogLevel(logLevel)); for (const auto& rule : coreLoggingConfig->Rules) { rule->ExcludeCategories = TConfig::Get()->LogExcludeCategories; } + + if (auto structuredLogPath = TConfig::Get()->StructuredLog) { + InitializeStructuredLogging(coreLoggingConfig, structuredLogPath); + RegisterStructuredLogWriterFactory(); + } + NLogging::TLogManager::Get()->Configure(coreLoggingConfig); } else { auto logger = CreateStdErrLogger(logLevel); @@ -198,6 +206,12 @@ void CommonInitialize(TGuard& g) for (const auto& rule : coreLoggingConfig->Rules) { rule->ExcludeCategories = TConfig::Get()->LogExcludeCategories; } + + if (auto structuredLogPath = TConfig::Get()->StructuredLog) { + InitializeStructuredLogging(coreLoggingConfig, structuredLogPath); + RegisterStructuredLogWriterFactory(); + } + NLogging::TLogManager::Get()->Configure(coreLoggingConfig); SetUseCoreLog(); } -- cgit v1.3