Some minor quality of life improvements related to the fact that the default value of --max_idle_secs is 15s when the TEST_TMPDIR environment variable is set.

(i) Add a log line to blaze.INFO when the server shuts itself down due to idleness.
(ii) Mention the --max_idle_secs default in the existing stderr spam when TEST_TMPDIR is set.

RELNOTES: None
PiperOrigin-RevId: 174745511
diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc
index 6728cc5..0737cd6 100644
--- a/src/main/cpp/blaze.cc
+++ b/src/main/cpp/blaze.cc
@@ -1284,12 +1284,6 @@
     blaze::UnsetEnv("_JAVA_OPTIONS");
   }
 
-  if (!blaze::GetEnv("TEST_TMPDIR").empty()) {
-    fprintf(stderr,
-            "INFO: $TEST_TMPDIR defined: output root default is '%s'.\n",
-            globals->options->output_root.c_str());
-  }
-
   // TODO(bazel-team):  We've also seen a failure during loading (creating
   // threads?) when ulimit -Hs 8192.  Characterize that and check for it here.
 
diff --git a/src/main/cpp/startup_options.cc b/src/main/cpp/startup_options.cc
index 84c0c05..23ce3e5 100644
--- a/src/main/cpp/startup_options.cc
+++ b/src/main/cpp/startup_options.cc
@@ -95,8 +95,15 @@
   bool testing = !blaze::GetEnv("TEST_TMPDIR").empty();
   if (testing) {
     output_root = MakeAbsolute(blaze::GetEnv("TEST_TMPDIR"));
+    max_idle_secs = 15;
+    fprintf(stderr,
+            "INFO: $TEST_TMPDIR defined: output root default is '%s' and "
+            "max_idle_secs default is '%d'.\n",
+            output_root.c_str(),
+            max_idle_secs);
   } else {
     output_root = workspace_layout->GetOutputRoot();
+    max_idle_secs = 3 * 3600;
   }
 
 #if defined(COMPILER_MSVC) || defined(__CYGWIN__)
@@ -110,8 +117,6 @@
   const string product_name_lower = GetLowercaseProductName();
   output_user_root = blaze_util::JoinPath(
       output_root, "_" + product_name_lower + "_" + GetUserName());
-  // 3 hours (but only 15 seconds if used within a test)
-  max_idle_secs = testing ? 15 : (3 * 3600);
 
   // IMPORTANT: Before modifying the statements below please contact a Bazel
   // core team member that knows the internal procedure for adding/deprecating
diff --git a/src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java b/src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java
index 6c9e6d2..9f18e53 100644
--- a/src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java
+++ b/src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java
@@ -701,6 +701,7 @@
       }
     }
 
+    logger.info("About to shutdown due to idleness");
     signalShutdown();
   }