test/java/util/logging/Logger/getGlobal/TestGetGlobal.java

Print this page

        

@@ -55,19 +55,27 @@
         System.setProperty("java.util.logging.config.file",
             System.getProperty("test.src", ".") + java.io.File.separator + "logging.properties");
     }
 
     public static void main(String... args) {
+        final String manager = System.getProperty("java.util.logging.manager", null);
+
+        final String description = "TestGetGlobal"
+            + (System.getSecurityManager() == null ? " " :
+               " -Djava.security.manager ")
+            + (manager == null ? "" : "-Djava.util.logging.manager=" + manager);
 
         Logger.global.info(messages[0]); // at this point LogManager is not
              // initialized yet, so this message should not appear.
         Logger.getGlobal().info(messages[1]); // calling getGlobal() will
              // initialize the LogManager - and thus this message should appear.
         Logger.global.info(messages[2]); // Now that the LogManager is
              // initialized, this message should appear too.
 
         final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, 1, messages.length));
         if (!testgetglobal.HandlerImpl.received.equals(expected)) {
-            throw new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected);
+            System.err.println("Test case failed: " + description);
+            throw new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected
+                            + "\n\t"+description);
         }
     }
 }