summaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/client/init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'yt/cpp/mapreduce/client/init.cpp')
-rw-r--r--yt/cpp/mapreduce/client/init.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/yt/cpp/mapreduce/client/init.cpp b/yt/cpp/mapreduce/client/init.cpp
index e55fc51388a..44d685d779e 100644
--- a/yt/cpp/mapreduce/client/init.cpp
+++ b/yt/cpp/mapreduce/client/init.cpp
@@ -17,6 +17,9 @@
#include <yt/cpp/mapreduce/common/helpers.h>
#include <yt/cpp/mapreduce/common/wait_proxy.h>
+#include <yt/yt/core/logging/log_manager.h>
+#include <yt/yt/core/logging/config.h>
+
#include <library/cpp/sighandler/async_signals_handler.h>
#include <util/folder/dirut.h>
@@ -148,6 +151,21 @@ static void ElevateInitStatus(const EInitStatus newStatus) {
NDetail::GetInitStatus() = Max(NDetail::GetInitStatus(), newStatus);
}
+NLogging::ELogLevel ToCoreLogLevel(ILogger::ELevel level)
+{
+ switch (level) {
+ case ILogger::FATAL:
+ return NLogging::ELogLevel::Fatal;
+ case ILogger::ERROR:
+ return NLogging::ELogLevel::Error;
+ case ILogger::INFO:
+ return NLogging::ELogLevel::Info;
+ case ILogger::DEBUG:
+ return NLogging::ELogLevel::Debug;
+ }
+ Y_ABORT();
+}
+
void CommonInitialize(int argc, const char** argv)
{
auto logLevelStr = to_lower(TConfig::Get()->LogLevel);
@@ -159,7 +177,15 @@ void CommonInitialize(int argc, const char** argv)
}
auto logPath = TConfig::Get()->LogPath;
- auto logger = logPath.empty() ? CreateStdErrLogger(logLevel) : CreateFileLogger(logLevel, logPath);
+ ILoggerPtr logger;
+ if (logPath.empty()) {
+ logger = CreateStdErrLogger(logLevel);
+ } else {
+ logger = CreateFileLogger(logLevel, logPath);
+
+ auto coreLoggingConfig = NLogging::TLogManagerConfig::CreateLogFile(logPath, ToCoreLogLevel(logLevel));
+ NLogging::TLogManager::Get()->Configure(coreLoggingConfig);
+ }
SetLogger(logger);
TProcessState::Get()->SetCommandLine(argc, argv);