--- old/src/hotspot/share/classfile/classLoader.cpp 2018-10-23 13:18:19.334269054 -0700 +++ new/src/hotspot/share/classfile/classLoader.cpp 2018-10-23 13:18:18.932231199 -0700 @@ -1472,13 +1472,13 @@ char* path = skip_uri_protocol(src); char* canonical_class_src_path = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, JVM_MAXPATHLEN); if (!get_canonical_path(path, canonical_class_src_path, JVM_MAXPATHLEN)) { - tty->print_cr("Bad pathname %s. CDS dump aborted.", path); + log_error(cds)("Bad pathname %s. CDS dump aborted.", path); vm_exit(1); } for (int i = 0; i < FileMapInfo::get_number_of_shared_paths(); i++) { SharedClassPathEntry* ent = FileMapInfo::shared_path(i); if (!get_canonical_path(ent->name(), canonical_path_table_entry, JVM_MAXPATHLEN)) { - tty->print_cr("Bad pathname %s. CDS dump aborted.", ent->name()); + log_error(cds)("Bad pathname %s. CDS dump aborted.", ent->name()); vm_exit(1); } // If the path (from the class stream source) is the same as the shared --- old/src/hotspot/share/classfile/classLoaderExt.cpp 2018-10-23 13:18:20.147345611 -0700 +++ new/src/hotspot/share/classfile/classLoaderExt.cpp 2018-10-23 13:18:19.763309451 -0700 @@ -34,6 +34,7 @@ #include "classfile/sharedPathsMiscInfo.hpp" #include "classfile/systemDictionaryShared.hpp" #include "classfile/vmSymbols.hpp" +#include "logging/log.hpp" #include "memory/allocation.inline.hpp" #include "memory/filemap.hpp" #include "memory/resourceArea.hpp" @@ -175,7 +176,7 @@ } if (strstr(manifest, "Extension-List:") != NULL) { - tty->print_cr("-Xshare:dump does not support Extension-List in JAR manifest: %s", entry->name()); + log_error(cds)("-Xshare:dump does not support Extension-List in JAR manifest: %s", entry->name()); vm_exit(1); } --- old/src/hotspot/share/memory/metaspace.cpp 2018-10-23 13:18:20.937420002 -0700 +++ new/src/hotspot/share/memory/metaspace.cpp 2018-10-23 13:18:20.581386479 -0700 @@ -1291,9 +1291,9 @@ if (DumpSharedSpaces) { // CDS dumping keeps loading classes, so if we hit an OOM we probably will keep hitting OOM. // We should abort to avoid generating a potentially bad archive. - tty->print_cr("Failed allocating metaspace object type %s of size " SIZE_FORMAT ". CDS dump aborted.", + log_error(cds)("Failed allocating metaspace object type %s of size " SIZE_FORMAT ". CDS dump aborted.", MetaspaceObj::type_name(type), word_size * BytesPerWord); - tty->print_cr("Please increase MaxMetaspaceSize (currently " SIZE_FORMAT " bytes).", MaxMetaspaceSize); + log_error(cds)("Please increase MaxMetaspaceSize (currently " SIZE_FORMAT " bytes).", MaxMetaspaceSize); vm_exit(1); } report_metadata_oome(loader_data, word_size, type, mdtype, THREAD); --- old/src/hotspot/share/memory/metaspaceShared.cpp 2018-10-23 13:18:21.720493733 -0700 +++ new/src/hotspot/share/memory/metaspaceShared.cpp 2018-10-23 13:18:21.357459551 -0700 @@ -1650,7 +1650,7 @@ // enable this when running real apps. SystemDictionary::remove_classes_in_error_state(); } else { - tty->print_cr("Please remove the unverifiable classes from your class list and try again"); + log_error(cds)("Please remove the unverifiable classes from your class list and try again"); exit(1); } } @@ -2029,14 +2029,14 @@ if (PrintSharedArchiveAndExit) { if (PrintSharedDictionary) { - tty->print_cr("\nShared classes:\n"); + log_info(cds)("\nShared classes:\n"); SystemDictionary::print_shared(tty); } if (_archive_loading_failed) { - tty->print_cr("archive is invalid"); + log_error(cds)("archive is invalid"); vm_exit(1); } else { - tty->print_cr("archive is valid"); + log_info(cds)("archive is valid"); vm_exit(0); } } --- old/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java 2018-10-23 13:18:22.508567936 -0700 +++ new/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java 2018-10-23 13:18:22.143533565 -0700 @@ -51,7 +51,7 @@ // Print the shared dictionary and inspect the output opts = (new CDSOptions()) .setUseVersion(false) - .addSuffix( "-cp", "\"\"", + .addSuffix( "-cp", "\"\"", "-Xlog:cds", "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName, "-XX:+PrintSharedArchiveAndExit", "-XX:+PrintSharedDictionary"); CDSTestUtils.run(opts) --- old/test/hotspot/jtreg/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java 2018-10-23 13:18:23.288641385 -0700 +++ new/test/hotspot/jtreg/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java 2018-10-23 13:18:22.912605979 -0700 @@ -46,7 +46,7 @@ opts = (new CDSOptions()) .setUseVersion(false) .addSuffix( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName, - "-XX:+PrintSharedArchiveAndExit", "-version"); + "-XX:+PrintSharedArchiveAndExit", "-Xlog:cds", "-version"); CDSTestUtils.run(opts) .assertNormalExit(output -> { output.shouldContain("archive is valid"); @@ -56,7 +56,7 @@ opts = (new CDSOptions()) .setUseVersion(false) .addSuffix( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName, - "-XX:+PrintSharedArchiveAndExit"); + "-XX:+PrintSharedArchiveAndExit", "-Xlog:cds"); CDSTestUtils.run(opts) .assertNormalExit(output -> { output.shouldContain("archive is valid");