Skip to content

Logging and diagnostics

Client

Use the project's logging abstraction instead of scattered println. For network failures, the most useful path is usually:

  1. Developer Settings network diagnostics;
  2. selected/current node and cooldown state;
  3. Control Plane status;
  4. Android logcat around HomeNodeConnection, CircuitRunner and the mailbox classes;
  5. corresponding node /index and Docker logs.

What the user sees

The user never reads an exception message, a class name or a log tag.

  • SparrowLog.error / logger.error: Logcat and the developer error log (Settings → Developer) only.
  • SparrowLog.showError(text): the only way an error reaches the user, always a translated string resource (EN and DE). The red snackbar stays until the user dismisses it; the same text is not shown again for a minute after that.
  • In a ViewModel, userFacingError(tag, failure, Res.string.…) logs the failure for developers and returns the translated sentence for the screen. Conversations use ConversationErrors.report(Res.string.…, failure).

Expected failures are not errors

A failure the app expects and retries by itself is logged at info level, without a stack trace, and never reaches the developer error log. Examples from the mailbox sync (MailboxPendingSynchronizer):

  • waiting for a circuit through enough hops (isWaitingForRoute()): "not read: waiting for a circuit through enough hops";
  • a mailbox node that is down, answers 502/503/504, or that the session node at the end of the circuit cannot reach (CircuitMailboxUnreachableException); markingNodeUnavailable() turns these into MailboxNodeUnavailableException: "Mailbox node of contact … is unavailable; retried on the next sync".

Right after start such a line can appear once, while the session node does not reach a mailbox node yet; the next sync reads the mailbox. Only other failures are warnings or errors. The gateway logs the server side of the same case ("Session request to … failed", see Docker & Troubleshooting).

Chat-open trace (temporary)

ChatOpenTrace (:core:util) measures how long opening a chat takes. OverviewViewModel starts it at 0 when a chat is tapped (begin("direct" | "group")), steps log event(stage), and MessageList ends it when the first message is laid out (end). After 6 seconds (a chat without messages) it stops on its own, so sending or receiving in an open chat logs nothing. Lines look like [group +184ms] first message item laid out … under the tag ChatOpenTrace. It uses monotonic time only and logs no conversation, contact or message identifiers. It is a diagnostic and will be removed once chat opening is fast enough.

Server

Server modules use the shared server:observability facilities for request IDs, health/readiness and metrics/logging integration.

Useful commands:

docker compose ps
docker compose logs -f
docker compose logs --since=5m gateway federation mailbox

Start troubleshooting from /index on the Control Plane or Community Node so you do not need to remember endpoint paths.

Secrets

Never log private keys, Firebase Admin credentials, release signing passwords, full bearer/internal tokens, mailbox capabilities or production database passwords.