Skip to content

feat(service): configurable log level, JSON output and sampling - #1144

Open
sbalabanov wants to merge 1 commit into
mainfrom
log/1b-configurable-logger
Open

sbalabanov wants to merge 1 commit into
mainfrom
log/1b-configurable-logger

Conversation

@sbalabanov

@sbalabanov sbalabanov commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

TLDR: Services now read LOG_LEVEL and LOG_FORMAT to choose how much they log and whether output is JSON or console, and no longer dump a metrics snapshot every 10 seconds.

Changes

  • Add service/logging: New() builds a zap production logger (sampling and Error-level stack traces kept) from LOG_LEVEL (debug, info, warn, error; default info) and LOG_FORMAT (json or console; default json). Invalid values return an error naming the variable.
  • Gateway, orchestrator, runway and stovepipe servers use logging.New() instead of zap.NewDevelopment().
  • Delete the metrics snapshot loops (the tally scope stays).
  • Compose files pass LOG_LEVEL (empty means info) and LOG_FORMAT (default console).
  • The queue only applies IncreaseLevel when the requested level is above the service logger's level, so a lower QUEUE_LOG_LEVEL no longer prints a plain-text stderr line; the "created SQL queue" line reports the effective level.
  • Console format uses ISO8601 timestamps; JSON is unchanged.
  • doc/howto/QUICKSTART.md now explains LOG_LEVEL and LOG_FORMAT and uses LOG_LEVEL=debug QUEUE_LOG_LEVEL=debug for queue debug output.
  • Compose comments describe only their own lines.
  • READMEs document both variables; QUEUE_LOG_LEVEL can only raise the queue logger above LOG_LEVEL, so queue debug output needs both set to debug.

Test Plan

  • make fmt, make lint, make check-gazelle, make check-tidy pass on a staged tree.
  • bazel test //service/... //platform/extension/messagequeue/... passes except TestNewProfiles_GitChangeProviderReadsARealRepository in //service/submitqueue/orchestrator/server, which needs a local gpgsm and fails identically on main.
  • grep -rn 'NewDevelopment\|metrics snapshot' service/ returns nothing.
  • Run locally: make local-submitqueue-start, then make local-submitqueue-logs shows console output with no Debug lines. Rerun with LOG_LEVEL=debug make local-submitqueue-start and Debug lines appear; add LOG_FORMAT=json for JSON output and QUEUE_LOG_LEVEL=debug for queue debug lines. The local stack was not started in this session.

🤖 Generated with Claude Code

@sbalabanov
sbalabanov force-pushed the log/1b-configurable-logger branch from fb7cd91 to 4ceba8b Compare November 25, 2026 23:54
Servers build their logger with service/logging, which reads LOG_LEVEL and LOG_FORMAT and keeps the production sampling and stack-trace settings. The periodic metrics snapshot loops are removed, and Compose files, READMEs and the quickstart document the new variables. The MySQL queue applies IncreaseLevel only when raising the level, so a queue level below the service level no longer prints a plain-text error to stderr.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@sbalabanov
sbalabanov force-pushed the log/1b-configurable-logger branch from 4ceba8b to 7154ea4 Compare November 25, 2026 23:56
@sbalabanov
sbalabanov marked this pull request as ready for review November 25, 2026 23:56
@sbalabanov
sbalabanov requested review from a team as code owners November 25, 2026 23:56

This branch has not been deployed

No deployments
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.

1 participant