From 93e027a022e855cb5d2c6e6feee0710d3a1f0aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E6=96=87=E9=94=8B0668000834?= Date: Wed, 18 Mar 2026 17:25:41 +0800 Subject: [PATCH] fix(launcher): show log init errors in GUI mode When the launcher fails to initialize the log file in GUI mode (non-console), the error message was being written to stderr which is not visible to users. This fix re-enables console logging before logging the error, ensuring that users can see the error message even in GUI mode. Fixes #1734 --- web/backend/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/backend/main.go b/web/backend/main.go index 922dc2f6dc..b910fdd270 100644 --- a/web/backend/main.go +++ b/web/backend/main.go @@ -81,7 +81,10 @@ func main() { logPath := filepath.Join(picoHome, "logs", "web.log") if err := logger.EnableFileLogging(logPath); err != nil { - fmt.Fprintf(os.Stderr, "Failed to initialize logger: %v\n", err) + // Re-enable console logging so the error is visible in GUI mode + logger.SetConsoleLevel(logger.INFO) + logger.Errorf("Failed to initialize log file at %s: %v", logPath, err) + logger.Error("Please check that the logs directory is writable") os.Exit(1) } defer logger.DisableFileLogging()