Skip to content

Fix gateway launchd log growth#922

Merged
ahgpt merged 1 commit into
mainfrom
fix/gateway-log-growth-no-script
Jun 11, 2026
Merged

Fix gateway launchd log growth#922
ahgpt merged 1 commit into
mainfrom
fix/gateway-log-growth-no-script

Conversation

@wuman001

Copy link
Copy Markdown
Collaborator

Summary

  • Suppress high-volume gateway/AWorld console logs from launchd stderr by default while keeping rotating gateway file logs.
  • Downgrade successful WeChat getupdates polling logs from INFO to DEBUG.
  • Preserve failure and startup diagnostics while avoiding noisy long-running poll and stream output in launchd stderr.

Test Plan

  • python -m py_compile aworld-cli/src/aworld_cli/gateway_cli.py aworld_gateway/logging.py aworld_gateway/channels/wechat/connector.py
  • PYTHONPATH=aworld-cli/src pytest tests/gateway/test_gateway_status_command.py tests/gateway/test_wechat_connector.py tests/test_gateway_cli.py -q

@wuman001 wuman001 requested a review from ahgpt June 11, 2026 08:55

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces changes to suppress console logging during the gateway server boot and allows configuring the uvicorn log level. It also reduces log noise in the WeChat connector by logging update requests at the debug level instead of info. The feedback suggests respecting existing environment variables in _suppress_gateway_console_logging to allow users to explicitly enable console logging, and wrapping the configure_gateway_logging call in the finally block of serve_gateway in a try...except block to prevent potential logging errors from masking other runtime exceptions.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +197 to 200
def _suppress_gateway_console_logging() -> None:
os.environ["AWORLD_DISABLE_CONSOLE_LOG"] = "true"
os.environ[GATEWAY_CONSOLE_LOG_ENV] = "false"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The _suppress_gateway_console_logging function unconditionally overwrites the AWORLD_DISABLE_CONSOLE_LOG and AWORLD_GATEWAY_CONSOLE_LOG environment variables. This prevents users from explicitly enabling console logging (e.g., for debugging or local development) via environment variables when running the gateway server.

Consider only setting these environment variables if they are not already set, and respecting the user's explicit settings.

Note: If you apply this suggestion, you will also need to update the test test_suppress_gateway_console_logging_reconfigures_enabled_logger in tests/gateway/test_gateway_status_command.py because it sets AWORLD_DISABLE_CONSOLE_LOG to "false" before calling _suppress_gateway_console_logging(), which would now correctly bypass suppression.

Suggested change
def _suppress_gateway_console_logging() -> None:
os.environ["AWORLD_DISABLE_CONSOLE_LOG"] = "true"
os.environ[GATEWAY_CONSOLE_LOG_ENV] = "false"
def _suppress_gateway_console_logging() -> None:
if "AWORLD_DISABLE_CONSOLE_LOG" not in os.environ:
os.environ["AWORLD_DISABLE_CONSOLE_LOG"] = "true"
if GATEWAY_CONSOLE_LOG_ENV not in os.environ:
os.environ[GATEWAY_CONSOLE_LOG_ENV] = "false"
if os.environ.get("AWORLD_DISABLE_CONSOLE_LOG") == "false":
return

Comment on lines +348 to +349
if gateway_log_path is not None:
configure_gateway_logging(log_path=gateway_log_path)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Calling configure_gateway_logging in the finally block could potentially raise an OSError (e.g., due to file system or permission issues) and mask the original exception that caused the gateway server to stop or fail to boot.

It is safer to wrap this call in a try...except block to ensure that any logging configuration errors during restoration do not suppress the actual runtime exception.

Suggested change
if gateway_log_path is not None:
configure_gateway_logging(log_path=gateway_log_path)
if gateway_log_path is not None:
try:
configure_gateway_logging(log_path=gateway_log_path)
except Exception:
pass

@ahgpt ahgpt merged commit 97d32b6 into main Jun 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants