diff options
author | 2015-03-09 22:46:51 +0000 | |
---|---|---|
committer | 2015-03-10 15:08:18 +0000 | |
commit | 47782da962581af60fc1bbb47e035908dfdd67f8 (patch) | |
tree | 32754a15c1b20469540f254919d690b2d1acc6e2 /src/main/java/com/google | |
parent | 730e3178f029c61c6be9f09a96f1ff97519c0a58 (diff) |
Force log flush at the end of a command execution.
--
MOS_MIGRATED_REVID=88160544
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java | 9 |
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 |