# HG changeset patch # User mockner # Date 1461078217 14400 # Node ID 1a816b464178fc23a9f52268a810f33241dc0ea3 # Parent e446184da25e0582a55dcb9aabeef6a3e8955f22 8151526: Print -Xlog configuration in the hs_err_pid file Summary: logging configuration is now printed in hs_err and in vm info. Reviewed-by: coleenp, mlarsson, dholmes diff -r e446184da25e -r 1a816b464178 hotspot/src/share/vm/logging/logConfiguration.cpp --- a/hotspot/src/share/vm/logging/logConfiguration.cpp Tue Apr 19 14:21:26 2016 +0200 +++ b/hotspot/src/share/vm/logging/logConfiguration.cpp Tue Apr 19 11:03:37 2016 -0400 @@ -382,7 +382,7 @@ return true; } -void LogConfiguration::describe(outputStream* out) { +void LogConfiguration::describe_available(outputStream* out){ out->print("Available log levels:"); for (size_t i = 0; i < LogLevel::Count; i++) { out->print("%s %s", (i == 0 ? "" : ","), LogLevel::name(static_cast(i))); @@ -402,7 +402,9 @@ } out->cr(); - ConfigurationLock cl; +} + +void LogConfiguration::describe_current_configuration(outputStream* out){ out->print_cr("Log output configuration:"); for (size_t i = 0; i < _n_outputs; i++) { out->print("#" SIZE_FORMAT ": %s %s ", i, _outputs[i]->name(), _outputs[i]->config_string()); @@ -416,6 +418,12 @@ } } +void LogConfiguration::describe(outputStream* out) { + describe_available(out); + ConfigurationLock cl; + describe_current_configuration(out); +} + void LogConfiguration::print_command_line_help(FILE* out) { jio_fprintf(out, "-Xlog Usage: -Xlog[:[what][:[output][:[decorators][:output-options]]]]\n" "\t where 'what' is a combination of tags and levels on the form tag1[+tag2...][*][=level][,...]\n" diff -r e446184da25e -r 1a816b464178 hotspot/src/share/vm/logging/logConfiguration.hpp --- a/hotspot/src/share/vm/logging/logConfiguration.hpp Tue Apr 19 14:21:26 2016 +0200 +++ b/hotspot/src/share/vm/logging/logConfiguration.hpp Tue Apr 19 11:03:37 2016 -0400 @@ -37,6 +37,7 @@ // kept implicitly in the LogTagSets and their LogOutputLists. During configuration the tagsets // are iterated over and updated accordingly. class LogConfiguration : public AllStatic { + friend class VMError; public: // Function for listeners typedef void (*UpdateListenerFunction)(void); @@ -79,6 +80,11 @@ // This should be called after any configuration change while still holding ConfigurationLock static void notify_update_listeners(); + // Respectively describe the built-in and runtime dependent portions of the configuration. + static void describe_available(outputStream* out); + static void describe_current_configuration(outputStream* out); + + public: // Initialization and finalization of log configuration, to be run at vm startup and shutdown respectively. static void initialize(jlong vm_start_time); diff -r e446184da25e -r 1a816b464178 hotspot/src/share/vm/utilities/vmError.cpp --- a/hotspot/src/share/vm/utilities/vmError.cpp Tue Apr 19 14:21:26 2016 +0200 +++ b/hotspot/src/share/vm/utilities/vmError.cpp Tue Apr 19 11:03:37 2016 -0400 @@ -28,6 +28,7 @@ #include "compiler/compileBroker.hpp" #include "compiler/disassembler.hpp" #include "gc/shared/collectedHeap.hpp" +#include "logging/logConfiguration.hpp" #include "prims/whitebox.hpp" #include "runtime/arguments.hpp" #include "runtime/atomic.inline.hpp" @@ -774,6 +775,13 @@ st->cr(); } + STEP(395, "(printing log configuration)") + if (_verbose){ + st->print_cr("Logging:"); + LogConfiguration::describe_current_configuration(st); + st->cr(); + } + STEP(400, "(printing all environment variables)" ) if (_verbose) { @@ -937,6 +945,11 @@ st->cr(); } + // STEP("(printing log configuration)") + st->print_cr("Logging:"); + LogConfiguration::describe(st); + st->cr(); + // STEP("(printing all environment variables)") os::print_environment_variables(st, env_list);