Skip to content

Change the default logging level to WARN from EMERG for CLI commands that support multiple verbosity levels #22612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ydb/apps/ydb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* Fixed decimal type comparison in `ydb workload * run` commands.
* Changed the default logging level from `EMERGENCY` to `ERROR` for commands that support multiple verbosity levels.
* Added a new paths approach in the `ydb export s3` and `ydb import s3` commands with the new `--include` option instead of the `--item` option.
* Added support for encryption features in the `ydb export s3` and `ydb import s3` commands.

Expand Down
2 changes: 1 addition & 1 deletion ydb/library/backup/backup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ void BackupFolderImpl(TDriver driver, const TString& database, const TString& db
} else if (dbIt.IsExternalTable()) {
BackupExternalTable(driver, dbIt.GetFullPath(), childFolderPath);
} else if (!dbIt.IsTable() && !dbIt.IsDir()) {
LOG_E("Skipping " << dbIt.GetFullPath().Quote() << ": dumping objects of type " << dbIt.GetCurrentNode()->Type << " is not supported");
LOG_W("Skipping " << dbIt.GetFullPath().Quote() << ": dumping objects of type " << dbIt.GetCurrentNode()->Type << " is not supported");
childFolderPath.Child(NDump::NFiles::Incomplete().FileName).DeleteIfExists();
childFolderPath.DeleteIfExists();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ ui32 TTopicOperationsScenario::GetTopicMaxPartitionCount() const
return TopicMaxPartitionCount >= TopicPartitionCount ? TopicMaxPartitionCount : (TopicPartitionCount << 3);
}

THolder<TLogBackend> TTopicOperationsScenario::MakeLogBackend(TConfig::EVerbosityLevel level)
THolder<TLogBackend> TTopicOperationsScenario::MakeLogBackend(ui32 level)
{
return CreateLogBackend("cerr",
TConfig::VerbosityLevelToELogPriority(level));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class TTopicOperationsScenario {

static NTable::TSession GetSession(NTable::TTableClient& client);

static THolder<TLogBackend> MakeLogBackend(TClientCommand::TConfig::EVerbosityLevel level);
static THolder<TLogBackend> MakeLogBackend(ui32 level);

void InitLog(TClientCommand::TConfig& config);
void InitDriver(TClientCommand::TConfig& config);
Expand Down
2 changes: 1 addition & 1 deletion ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ void TClientCommandRootCommon::Config(TConfig& config) {

void TClientCommandRootCommon::Parse(TConfig& config) {
TClientCommandRootBase::Parse(config);
config.VerbosityLevel = std::min(static_cast<TConfig::EVerbosityLevel>(VerbosityLevel), TConfig::EVerbosityLevel::DEBUG);
config.VerbosityLevel = VerbosityLevel;
}

void TClientCommandRootCommon::ExtractParams(TConfig& config) {
Expand Down
26 changes: 11 additions & 15 deletions ydb/public/lib/ydb_cli/common/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,31 +51,27 @@ TClientCommand::TClientCommand(
Opts.GetOpts().SetWrap(Max(Opts.GetOpts().Wrap_, static_cast<ui32>(lineLength)));
}

ELogPriority TClientCommand::TConfig::VerbosityLevelToELogPriority(TClientCommand::TConfig::EVerbosityLevel lvl) {
ELogPriority TClientCommand::TConfig::VerbosityLevelToELogPriority(ui32 lvl) {
switch (lvl) {
case TClientCommand::TConfig::EVerbosityLevel::NONE:
return ELogPriority::TLOG_EMERG;
case TClientCommand::TConfig::EVerbosityLevel::DEBUG:
return ELogPriority::TLOG_DEBUG;
case TClientCommand::TConfig::EVerbosityLevel::INFO:
return ELogPriority::TLOG_INFO;
case TClientCommand::TConfig::EVerbosityLevel::WARN:
case 0:
return ELogPriority::TLOG_WARNING;
case 1:
return ELogPriority::TLOG_NOTICE;
case 2:
return ELogPriority::TLOG_INFO;
case 3:
default:
return ELogPriority::TLOG_ERR;
return ELogPriority::TLOG_DEBUG;
}
}

ELogPriority TClientCommand::TConfig::VerbosityLevelToELogPriorityChatty(TClientCommand::TConfig::EVerbosityLevel lvl) {
ELogPriority TClientCommand::TConfig::VerbosityLevelToELogPriorityChatty(ui32 lvl) {
switch (lvl) {
case TClientCommand::TConfig::EVerbosityLevel::NONE:
case 0:
return ELogPriority::TLOG_INFO;
case TClientCommand::TConfig::EVerbosityLevel::DEBUG:
case TClientCommand::TConfig::EVerbosityLevel::INFO:
case TClientCommand::TConfig::EVerbosityLevel::WARN:
default:
return ELogPriority::TLOG_DEBUG;
}
return ELogPriority::TLOG_INFO;
}

size_t TClientCommand::TConfig::ParseHelpCommandVerbosilty(int argc, char** argv) {
Expand Down
15 changes: 4 additions & 11 deletions ydb/public/lib/ydb_cli/common/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,8 @@ class TClientCommand {
TArgSetting Max;
};

enum EVerbosityLevel : ui32 {
NONE = 0,
WARN = 1,
INFO = 2,
DEBUG = 3,
};

static ELogPriority VerbosityLevelToELogPriority(EVerbosityLevel lvl);
static ELogPriority VerbosityLevelToELogPriorityChatty(EVerbosityLevel lvl);
static ELogPriority VerbosityLevelToELogPriority(ui32 lvl);
static ELogPriority VerbosityLevelToELogPriorityChatty(ui32 lvl);

int ArgC;
char** ArgV;
Expand Down Expand Up @@ -135,7 +128,7 @@ class TClientCommand {
TString Oauth2KeyFile;
TString Oauth2KeyParams;

EVerbosityLevel VerbosityLevel = EVerbosityLevel::NONE;
ui32 VerbosityLevel = 0;
size_t HelpCommandVerbosiltyLevel = 1; // No options -h or one - 1, -hh - 2, -hhh - 3 etc

bool JsonUi64AsText = false;
Expand Down Expand Up @@ -207,7 +200,7 @@ class TClientCommand {
static size_t ParseHelpCommandVerbosilty(int argc, char** argv);

bool IsVerbose() const {
return VerbosityLevel != EVerbosityLevel::NONE;
return VerbosityLevel > 0;
}

void SetFreeArgsMin(size_t value) {
Expand Down
Loading