diff --git a/app/src/main/java/io/xpipe/app/core/AppLogs.java b/app/src/main/java/io/xpipe/app/core/AppLogs.java index 40d5f6fe..8d310326 100644 --- a/app/src/main/java/io/xpipe/app/core/AppLogs.java +++ b/app/src/main/java/io/xpipe/app/core/AppLogs.java @@ -80,6 +80,12 @@ public class AppLogs { hookUpSystemErr(); } + public void flush() { + if (outFileStream != null) { + outFileStream.flush(); + } + } + private static boolean shouldWriteLogs() { if (System.getProperty(WRITE_LOGS_PROP) != null) { return Boolean.parseBoolean(System.getProperty(WRITE_LOGS_PROP)); diff --git a/app/src/main/java/io/xpipe/app/issue/SentryErrorHandler.java b/app/src/main/java/io/xpipe/app/issue/SentryErrorHandler.java index 878e4549..9f875115 100644 --- a/app/src/main/java/io/xpipe/app/issue/SentryErrorHandler.java +++ b/app/src/main/java/io/xpipe/app/issue/SentryErrorHandler.java @@ -111,6 +111,11 @@ public class SentryErrorHandler implements ErrorHandler { private static void fillScope(ErrorEvent ee, IScope s) { if (ee.isShouldSendDiagnostics()) { + // Write all buffered output to log files to ensure that we get all information + if (AppLogs.get() != null) { + AppLogs.get().flush(); + } + var atts = ee.getAttachments().stream() .map(d -> { try {