changeset 13412:d0212a5d61a4

-verbose:module should imply -Xlog:module+unload
author alanb
date Mon, 24 Apr 2017 09:13:44 +0100
parents 614a60bb7a26
children 7a2d0887831d
files src/share/vm/classfile/moduleEntry.cpp src/share/vm/runtime/arguments.cpp test/runtime/logging/ModulesTest.java
diffstat 3 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/moduleEntry.cpp	Sun Apr 23 12:00:42 2017 +0100
+++ b/src/share/vm/classfile/moduleEntry.cpp	Mon Apr 24 09:13:44 2017 +0100
@@ -236,6 +236,9 @@
       m = m->next();
 
       ResourceMark rm;
+      if (to_remove->name() != NULL) {
+        log_info(module, unload)("unloading module %s", to_remove->name()->as_C_string());
+      }
       log_debug(module)("ModuleEntryTable: deleting module: %s", to_remove->name() != NULL ?
                         to_remove->name()->as_C_string() : UNNAMED_MODULE);
 
--- a/src/share/vm/runtime/arguments.cpp	Sun Apr 23 12:00:42 2017 +0100
+++ b/src/share/vm/runtime/arguments.cpp	Mon Apr 24 09:13:44 2017 +0100
@@ -2843,6 +2843,7 @@
         LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(class, unload));
       } else if (!strcmp(tail, ":module")) {
         LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(module, load));
+        LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(module, unload));
       } else if (!strcmp(tail, ":gc")) {
         LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc));
       } else if (!strcmp(tail, ":jni")) {
--- a/test/runtime/logging/ModulesTest.java	Sun Apr 23 12:00:42 2017 +0100
+++ b/test/runtime/logging/ModulesTest.java	Mon Apr 24 09:13:44 2017 +0100
@@ -37,7 +37,10 @@
     public static void main(String[] args) throws Exception {
         testModuleTrace("-Xlog:module=trace", "-version");
         testModuleLoad("-Xlog:module+load", "-version");
-        testModuleLoad("-verbose:module", "-version");  // same as -Xlog:module+load
+        testModuleUnload("-Xlog:module+unload", "-version");
+
+        // same as -Xlog:module+load -Xlog:module+unload
+        testModuleLoad("-verbose:module", "-version");
     }
 
     static void testModuleTrace(String... args) throws Exception {
@@ -60,6 +63,11 @@
         output.shouldHaveExitValue(0);
     }
 
+    static void testModuleUnload(String... args) throws Exception {
+        OutputAnalyzer output = run(args);
+        output.shouldHaveExitValue(0);
+    }
+
     static OutputAnalyzer run(String... args) throws Exception {
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
         return new OutputAnalyzer(pb.start());