From 97a8ad5bc3960fb228ddb7d55a20e5c35a086434 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Thu, 2 Jul 2026 16:38:32 +0200 Subject: [PATCH] feat: mirror server text log to a fixed brewpi.latest.log Same principle as log_latest.json/log_latest_sud.json: a tail-style consumer can point at one unchanging path instead of tracking the current run's timestamped filename. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01GpePKZiEZWbGo9HrfuML6U --- server/brewpi.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/brewpi.py b/server/brewpi.py index 3b46c05..334f013 100755 --- a/server/brewpi.py +++ b/server/brewpi.py @@ -66,8 +66,14 @@ if __name__ == '__main__': os.makedirs(args.logdir, exist_ok=True) log_path = f"{args.logdir}/brewpi.{time.strftime("%Y%m%d%H%M%S", time.localtime())}.log" log_file = open(log_path, "a", buffering=1) - sys.stdout = Tee(sys.stdout, log_file) - sys.stderr = Tee(sys.stderr, log_file) + # Fixed (no-date) name written alongside the dated one - always + # truncated and re-mirrored, so a tail-style consumer can point at one + # unchanging path instead of tracking this run's own timestamped + # filename (same principle as ServerLogTask/SudLogTask's log_latest*.json). + latest_log_path = f"{args.logdir}/brewpi.latest.log" + latest_log_file = open(latest_log_path, "w", buffering=1) + sys.stdout = Tee(sys.stdout, log_file, latest_log_file) + sys.stderr = Tee(sys.stderr, log_file, latest_log_file) print("Logging to {}".format(log_path)) config = json.load(open(args.config))