Skip to content

[log] Add debug logging to HTTP server lifecycle in serve.go#7123

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
log/enhance-serve-029c5df7ac68ec64
Draft

[log] Add debug logging to HTTP server lifecycle in serve.go#7123
github-actions[bot] wants to merge 1 commit into
mainfrom
log/enhance-serve-029c5df7ac68ec64

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Jun 6, 2026

Adds 5 meaningful debugLog calls to serveAndWait in internal/cmd/serve.go, covering key HTTP server lifecycle events:

Log call Event
Starting HTTP server: addr=%s, shutdownTimeout=%s Function entry — server address and timeout
HTTP server exited unexpectedly, triggering shutdown: %v Unexpected exit from serveFn before context is cancelled
Shutdown signal received, beginning graceful HTTP server shutdown Context cancellation — graceful shutdown begins
Graceful shutdown failed, forcing close: %v httpServer.Shutdown() returned an error
HTTP server shut down gracefully Clean graceful shutdown path

Why this file?

serveAndWait is the core server lifecycle helper called from root.go for every gateway startup. It orchestrates background serving, signal handling, graceful shutdown, and error propagation — but had zero debug visibility. These logs help diagnose startup failures and shutdown timing issues.

Implementation notes

  • Reuses the existing package-level debugLog = logger.New("cmd:root") declared in root.go — no new logger or import needed
  • No side effects in log arguments (only uses already-computed values httpServer.Addr, timeout, err)
  • All tests pass (make test-all green; Rust guard failure is a pre-existing network sandbox limitation)

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • index.crates.io

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "index.crates.io"

See Network Configuration for more information.

Generated by Go Logger Enhancement · sonnet46 8.3M ·

Add 5 meaningful debug log calls to the serveAndWait function using
the existing package-level debugLog logger. These log server startup,
unexpected exits, shutdown signal receipt, graceful shutdown failures,
and successful graceful shutdown — all key lifecycle events that aid
in troubleshooting server startup and shutdown behaviour.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants