diff options
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(); } |
