mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-30 00:56:56 +13:00
Flush logs on error
This commit is contained in:
parent
c6cca15a9a
commit
e89fb97d53
2 changed files with 11 additions and 0 deletions
|
@ -80,6 +80,12 @@ public class AppLogs {
|
||||||
hookUpSystemErr();
|
hookUpSystemErr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void flush() {
|
||||||
|
if (outFileStream != null) {
|
||||||
|
outFileStream.flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean shouldWriteLogs() {
|
private static boolean shouldWriteLogs() {
|
||||||
if (System.getProperty(WRITE_LOGS_PROP) != null) {
|
if (System.getProperty(WRITE_LOGS_PROP) != null) {
|
||||||
return Boolean.parseBoolean(System.getProperty(WRITE_LOGS_PROP));
|
return Boolean.parseBoolean(System.getProperty(WRITE_LOGS_PROP));
|
||||||
|
|
|
@ -111,6 +111,11 @@ public class SentryErrorHandler implements ErrorHandler {
|
||||||
|
|
||||||
private static void fillScope(ErrorEvent ee, IScope s) {
|
private static void fillScope(ErrorEvent ee, IScope s) {
|
||||||
if (ee.isShouldSendDiagnostics()) {
|
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()
|
var atts = ee.getAttachments().stream()
|
||||||
.map(d -> {
|
.map(d -> {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue