Make crashing test logger shut down the server
Previously the crashing logger would allow the server process to survive
which could leave things in a weird state if a crash was expected. Instead
of throwing an exception shut down the runtime.
--
MOS_MIGRATED_REVID=112589751
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 9474ea1..fccc070 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
@@ -1208,18 +1208,18 @@
new Handler() {
@Override
public void publish(LogRecord record) {
+ System.err.println("Remote logging disabled for testing, forcing abrupt shutdown.");
+ System.err.printf("%s#%s: %s\n",
+ record.getSourceClassName(),
+ record.getSourceMethodName(),
+ record.getMessage());
+
Throwable e = record.getThrown();
- String message =
- record.getSourceClassName()
- + "#"
- + record.getSourceMethodName()
- + ": "
- + record.getMessage();
- if (e == null) {
- throw new IllegalStateException(message);
- } else {
- throw new IllegalStateException(message, e);
+ if (e != null) {
+ e.printStackTrace();
}
+
+ Runtime.getRuntime().halt(ExitCode.BLAZE_INTERNAL_ERROR.getNumericExitCode());
}
@Override