Skip to content

Route all Rocket internal logs through gem_tracing#975

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-error-logging-format
Draft

Route all Rocket internal logs through gem_tracing#975
Copilot wants to merge 4 commits intomainfrom
copilot/fix-error-logging-format

Conversation

Copy link
Contributor

Copilot AI commented Feb 28, 2026

Rocket's internal log events (guard failures, 404s, catcher responses) were emitted via its own RocketLogger with a > prefix format, inconsistent with the project's gem_tracing structured output.

Root cause

Rocket 0.5 uses the log crate and registers RocketLogger via log::set_boxed_logger — a one-time global. Nothing previously claimed that slot first.

Changes

  • crates/tracing — add log = "0.4" dep; implement GemLogger (log::Log) that converts every log event into a tracing event routed through the existing FmtSubscriber; expose init() which registers GemLogger and sets the level filter from ROCKET_LOG_LEVEL env var (default: normal; values: off / critical / normal / debug)

  • apps/api/src/main.rs — call gem_tracing::init() at the top of main(), before any rocket::build(). Rocket's subsequent set_boxed_logger call silently fails (already taken), so its events flow through GemLogger

  • apps/api/src/devices/guard.rs — explicitly log auth guard failures via info_with_fields! with structured fields (uri, status, error, user_agent) before the guard returns an error outcome

Result

Rocket's "Request guard \AuthenticatedDevice` failed: ..."and similar messages now emit in the same format as all other application logs. Log verbosity is runtime-configurable viaROCKET_LOG_LEVEL`.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.rocket.rs
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@semanticdiff-com
Copy link

semanticdiff-com bot commented Feb 28, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  Cargo.lock Unsupported file format
  apps/api/src/devices/guard.rs  0% smaller
  apps/api/src/main.rs  0% smaller
  crates/tracing/Cargo.toml Unsupported file format
  crates/tracing/src/lib.rs  0% smaller

Co-authored-by: gemcoder21 <104884878+gemcoder21@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error logging format for device not found Use gem_tracing for device auth guard error logging Feb 28, 2026
Copilot AI and others added 2 commits February 28, 2026 19:27
…acing

Co-authored-by: gemcoder21 <104884878+gemcoder21@users.noreply.github.com>
…able via ROCKET_LOG_LEVEL env var

Co-authored-by: gemcoder21 <104884878+gemcoder21@users.noreply.github.com>
Copilot AI changed the title Use gem_tracing for device auth guard error logging Route all Rocket internal logs through gem_tracing Feb 28, 2026
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