Repository navigation
Log the watchdog's INFO lines to the journal - #192
Merged
Merged
Conversation
The native packages run the watchdog as ttp-watchdog, which cannot open root's /run/ttp/ttp.log (0600). setup_logging() returned early in that case, before any console handler, so the ttp logger had no handler at all: Python's last-resort handler printed WARNING and above, and INFO lines appeared nowhere, a healed Tor among them. Found by the first run of scripts/vm/lifecycle/heal.sh (#191), which waited for the heal's INFO line in the journal and never saw it. A file that cannot be opened now skips only the file handler. When systemd has connected stderr to the journal (JOURNAL_STREAM names stderr's device and inode, as the variable is inherited by children), and no console handler is configured, INFO and above go to stderr, each line prefixed with its syslog priority (<6>, <4>, ...), so journalctl records the level and -p filters on it. A root watchdog keeps its file and gains the journal; --quiet keeps the journal quiet; a CLI run from a terminal is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
…logging Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com> # Conflicts: # CHANGELOG.md # docs/web/release-notes/changelog.md
With the journal handler, the watchdog running as ttp-watchdog logs "Watchdog: Restarted Tor service successfully." at INFO. heal.sh now requires that line, read with `journalctl -p info..info` so the priority journald recorded is checked too. Before this branch the confined watchdog logged nothing below WARNING, and this check would have failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The native packages run the watchdog as
ttp-watchdog. That account cannot open root's/run/ttp/ttp.log(mode 0600). In that casesetup_logging()returned before adding any handler, so Python's last-resort handler printed only WARNING and above. INFO lines appeared nowhere, neither in the file nor in the journal. One of them is the confirmation that a Tor heal succeeded. This contradictswatchdog-fsm.md, which says the result is injournalctl -u ttp-watchdog.The first run of
scripts/vm/lifecycle/heal.shin #191 found this: it waited for the heal's INFO line, and the journal never received it.Fix
setup_logging()now skips only the file handler.<6>,<4>, …), so the journal records the level andjournalctl -p warningworks.JOURNAL_STREAMmust name stderr's device and inode. Children inherit the variable, so the variable alone is not enough.--quietkeeps the journal quiet. A CLI started from a terminal behaves as before.Tests
tests/test_logging_journal.pywrites to a real file standing in for stderr:<6>and<3>; DEBUG does not.JOURNAL_STREAM, a mismatched one, or a malformed one adds no handler.--quiet, nothing is written.The two positive tests failed before the change. Full suite: 1891 passed.
Once #191 is merged, I will make
heal.shalso require the heal's INFO line in the journal, so the VM job checks this end to end.🤖 Generated with Claude Code