Dev.to
7/6/2026

Detecting the running site from streaming logs — why log-order inference broke, and how one marker fixed it
Short summary
A maintenance UI inferred which site was running by watching streaming logs in real-time. Three debugging rounds revealed the root problems: non-monotonic log ordering, pre-emitted backend init logs, and state resets that swept up unrelated records. The fix applies three principles: use one explicit marker line instead of loose inference, separate state detection from confirmation, and always scope state resets to the current run.
- •Log-order inference failed due to non-monotonic ordering and pre-emitted init logs from the backend
- •Solution: watch only the explicit "Starting maintenance" marker instead of inferring from all log lines
- •Key principles: use explicit markers over inference, separate "what's running" from "what's done", and scope state resets to avoid unrelated collateral damage
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



