aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
index dddc006a4d..d911820c37 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
@@ -140,6 +140,7 @@ import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
@@ -828,6 +829,14 @@ public final class BlazeRuntime {
} catch (IOException e) {
getReporter().handle(Event.error("Error while writing profile file: " + e.getMessage()));
}
+
+ // If this is not a crash we flush the log after the command finishes.
+ if (exitCode < 30) {
+ LOG.info("Forcing flush of the logs");
+ for (Handler handler : Logger.getLogger("").getHandlers()) {
+ handler.flush();
+ }
+ }
}
// Make sure we keep a strong reference to this logger, so that the