Skip to content

Commit

Permalink
Introduce new env var: YarnDevToolsEnvVar.ENABLE_LOGGER_HANDLER_SANIT…
Browse files Browse the repository at this point in the history
…Y_CHECK and parse its value in LoggingHelper.configure_logging
  • Loading branch information
szilard-nemeth committed Aug 17, 2024
1 parent fe3eabf commit 090e732
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions yarndevtools/common/shared_command_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class YarnDevToolsEnvVar(Enum):
ENV_HADOOP_DEV_DIR = "HADOOP_DEV_DIR"
YARNDEVTOOLS_BRANCH = "YARNDEVTOOLS_BRANCH"
YARNDEVTOOLS_MODULE_VERSION = "YARNDEVTOOLS_MODULE_VERSION"
# TODO copy of CdswEnvVar.ENABLE_LOGGER_HANDLER_SANITY_CHECK
ENABLE_LOGGER_HANDLER_SANITY_CHECK = "ENABLE_LOGGER_HANDLER_SANITY_CHECK"


class RepoType(Enum):
Expand Down
6 changes: 6 additions & 0 deletions yarndevtools/yarn_dev_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ def configure_logging(args):
# log_level = determine_logging_level(args)
debug = getattr(args, "logging_debug", False)
trace = getattr(args, "logging_trace", False)

sanity_check_number_of_handlers = OsUtils.is_env_var_true(
YarnDevToolsEnvVar.ENABLE_LOGGER_HANDLER_SANITY_CHECK.value, default_val=True
)

logging_config: SimpleLoggingSetupConfig = SimpleLoggingSetup.init_logger(
project_name=YARNDEVTOOLS_MODULE_NAME,
logger_name_prefix=YARNDEVTOOLS_MODULE_NAME,
Expand All @@ -117,6 +122,7 @@ def configure_logging(args):
repos=[YarnDevToolsConfig.UPSTREAM_REPO.repo, YarnDevToolsConfig.DOWNSTREAM_REPO.repo],
verbose_git_log=args.verbose,
with_trace_level=True,
sanity_check_number_of_handlers=sanity_check_number_of_handlers,
)
# LOG.trace("test trace")
LOG.info("Logging to files: %s", logging_config.log_file_paths)
Expand Down

0 comments on commit 090e732

Please sign in to comment.