Skip to content

Commit

Permalink
Fix file logging level issue.
Browse files Browse the repository at this point in the history
Fixes #223
  • Loading branch information
tpapaioa committed Apr 17, 2024
1 parent 5fa99d9 commit 726bc3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions broker/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,15 +371,15 @@ def __hash__(self):


def update_log_level(ctx, param, value):
"""Update the log level and file logging settings for the Broker.
"""Click callback to update the console log level for Broker.
Args:
ctx: The Click context object.
param: The Click parameter object.
value: The new log level value.
"""
b_log.set_log_level(value)
b_log.set_file_logging(value)
b_log.set_file_logging()


def set_emit_file(ctx, param, value):
Expand All @@ -393,7 +393,8 @@ def fork_broker():
if pid:
logger.info(f"Running broker in the background with pid: {pid}")
sys.exit(0)
update_log_level(None, None, "silent")
b_log.set_log_level("silent")
b_log.set_file_logging("silent")


def handle_keyboardinterrupt(*args):
Expand Down
2 changes: 2 additions & 0 deletions broker/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ def setup_logzero(
):
"""Call logzero setup with the given settings."""
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# FIXME helpers.update_log_level also needs to do this,
# if "--log-level trace" is passed to the CLI.
if isinstance(level, str) and level.lower() == "trace":
patch_awx_for_verbosity(awxkit.api)
set_log_level(level)
Expand Down

0 comments on commit 726bc3d

Please sign in to comment.