diff options
| author | hiddenpath <[email protected]> | 2025-05-03 01:51:57 +0300 |
|---|---|---|
| committer | hiddenpath <[email protected]> | 2025-05-03 02:02:40 +0300 |
| commit | 0a53819a4fa41d22e878c4cd3c4d95330f583deb (patch) | |
| tree | 33851f3ef8ddc4966b4539946e254cf1f400d779 /yt/cpp/mapreduce/client/init.cpp | |
| parent | acb2861c75522a1fb9ccfaf8fec3ed71aca4a685 (diff) | |
YT-24500: Introduce structured logging
commit_hash:e6ea4db1e3a66694223008fec3b5064a4d58a8e1
Diffstat (limited to 'yt/cpp/mapreduce/client/init.cpp')
| -rw-r--r-- | yt/cpp/mapreduce/client/init.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
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 <yt/cpp/mapreduce/interface/operation.h> #include <yt/cpp/mapreduce/interface/logging/logger.h> +#include <yt/cpp/mapreduce/interface/logging/structured.h> #include <yt/cpp/mapreduce/interface/logging/yt_log.h> #include <yt/cpp/mapreduce/io/job_reader.h> @@ -184,10 +185,17 @@ void CommonInitialize(TGuard<TMutex>& 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<TMutex>& 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(); } |
