From 82d6b6b8457bae201767e87d3034519a166b3ec6 Mon Sep 17 00:00:00 2001 From: Gold856 <117957790+Gold856@users.noreply.github.com> Date: Sat, 11 Oct 2025 00:25:54 -0400 Subject: [PATCH] Make exported journalctl logs less verbose and always display everything (#2101) ## Description There was a recent occurance of journalctl logs saying something like `[66B blob data]`. We don't log anything binary, so journalctl might be hiding some lines, thinking they're actually binary data when they're actually plain text. Use `-a` to always log everything. If it's binary data anyways, we'll want to know what it is anyways. Use `--output cat` because we output our own timestamps and we don't want journalctl's own timestamping. Filter the output through `sed` to remove ANSI color codes to make reading logs easier. ## Meta Merge checklist: - [x] Pull Request title is [short, imperative summary](https://cbea.ms/git-commit/) of proposed changes - [x] The description documents the _what_ and _why_ - [x] If this PR changes behavior or adds a feature, user documentation is updated - [ ] If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly - [ ] If this PR touches configuration, this is backwards compatible with settings back to v2025.3.2 - [ ] If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated - [ ] If this PR addresses a bug, a regression test for it is added --- docs/source/docs/troubleshooting/unix-commands.md | 6 ++++-- .../main/java/org/photonvision/server/RequestHandler.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/source/docs/troubleshooting/unix-commands.md b/docs/source/docs/troubleshooting/unix-commands.md index 4f8e5e3fd..252df1df7 100644 --- a/docs/source/docs/troubleshooting/unix-commands.md +++ b/docs/source/docs/troubleshooting/unix-commands.md @@ -122,11 +122,13 @@ systemctl status photonvision View the PhotonVision logs: ``` -journalctl -u photonvision +journalctl --output cat -u photonvision ``` View the PhotonVision logs in real-time: ``` -journalctl -u photonvision -f +journalctl --output cat -u photonvision -f ``` + +`--output cat` is used to prevent journalctl from printing its own timestamps, because we log our own timestamps. diff --git a/photon-server/src/main/java/org/photonvision/server/RequestHandler.java b/photon-server/src/main/java/org/photonvision/server/RequestHandler.java index fbc7151d4..d3ab08adb 100644 --- a/photon-server/src/main/java/org/photonvision/server/RequestHandler.java +++ b/photon-server/src/main/java/org/photonvision/server/RequestHandler.java @@ -435,7 +435,7 @@ public class RequestHandler { // dmesg = output all kernel logs since current boot // cat /var/log/kern.log = output all kernel logs since first boot shell.executeBashCommand( - "journalctl -u photonvision.service > " + "journalctl -a --output cat -u photonvision.service | sed -E 's/\\x1B\\[(0|30|31|32|33|34|35|36|37)m//g' >" + tempPath.toAbsolutePath() + " && dmesg > " + tempPath2.toAbsolutePath());