diff options
author | whatsername <whatsername@yandex-team.com> | 2024-07-15 22:46:57 +0300 |
---|---|---|
committer | whatsername <whatsername@yandex-team.com> | 2024-07-15 22:58:06 +0300 |
commit | 6e7ddec83991f734749824466ba89e35fff8904c (patch) | |
tree | efb71ba710bc5fa0d9f0becde73dea092d9022bd | |
parent | 61e081f1cbcf1492678dc056c3d63cc847d029bc (diff) | |
download | ydb-6e7ddec83991f734749824466ba89e35fff8904c.tar.gz |
YT-22268: Support YT_LOG_PATH in c++ api
Проверил руками на тестах yt roren
eb7589ac6894bffb1ebcd1d092f4eed6ca4cd975
-rw-r--r-- | yt/cpp/mapreduce/client/init.cpp | 4 | ||||
-rw-r--r-- | yt/cpp/mapreduce/interface/config.cpp | 1 | ||||
-rw-r--r-- | yt/cpp/mapreduce/interface/config.h | 1 |
3 files changed, 5 insertions, 1 deletions
diff --git a/yt/cpp/mapreduce/client/init.cpp b/yt/cpp/mapreduce/client/init.cpp index c74598ba14b..f05888befb1 100644 --- a/yt/cpp/mapreduce/client/init.cpp +++ b/yt/cpp/mapreduce/client/init.cpp @@ -158,7 +158,9 @@ void CommonInitialize(int argc, const char** argv) exit(1); } - SetLogger(CreateStdErrLogger(logLevel)); + auto logPath = TConfig::Get()->LogPath; + auto logger = logPath.Empty() ? CreateStdErrLogger(logLevel) : CreateFileLogger(logLevel, logPath); + SetLogger(logger); TProcessState::Get()->SetCommandLine(argc, argv); } diff --git a/yt/cpp/mapreduce/interface/config.cpp b/yt/cpp/mapreduce/interface/config.cpp index 0058962484c..1ee5a77af7f 100644 --- a/yt/cpp/mapreduce/interface/config.cpp +++ b/yt/cpp/mapreduce/interface/config.cpp @@ -193,6 +193,7 @@ void TConfig::Reset() Prefix = GetEnv("YT_PREFIX"); ApiVersion = GetEnv("YT_VERSION", "v3"); LogLevel = GetEnv("YT_LOG_LEVEL", "error"); + LogPath = GetEnv("YT_LOG_PATH"); ContentEncoding = GetEncoding("YT_CONTENT_ENCODING"); AcceptEncoding = GetEncoding("YT_ACCEPT_ENCODING"); diff --git a/yt/cpp/mapreduce/interface/config.h b/yt/cpp/mapreduce/interface/config.h index 3debc8a9616..27a31281bac 100644 --- a/yt/cpp/mapreduce/interface/config.h +++ b/yt/cpp/mapreduce/interface/config.h @@ -78,6 +78,7 @@ struct TConfig TString Prefix; TString ApiVersion; TString LogLevel; + TString LogPath; // Compression for data that is sent to YT cluster. EEncoding ContentEncoding; |