# HG changeset patch # User ysuenaga # Date 1467806288 -32400 # Node ID 4974c8df2532915c86b3726fbfcb6a1b15504788 # Parent 8b8fd966478b2dd8c2169903ecad2f4b51aa56d3 8153074: UL: Show output option in VM.log jcmd Reviewed-by: dholmes, mlarsson diff -r 8b8fd966478b -r 4974c8df2532 hotspot/src/share/vm/logging/logConfiguration.cpp --- a/hotspot/src/share/vm/logging/logConfiguration.cpp Sat Jul 09 19:20:38 2016 -0700 +++ b/hotspot/src/share/vm/logging/logConfiguration.cpp Wed Jul 06 20:58:08 2016 +0900 @@ -415,17 +415,8 @@ 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 ", i, _outputs[i]->name()); - out->print_raw(_outputs[i]->config_string()); - out->print(" "); - char delimiter[2] = {0}; - for (size_t d = 0; d < LogDecorators::Count; d++) { - LogDecorators::Decorator decorator = static_cast(d); - if (_outputs[i]->decorators().is_decorator(decorator)) { - out->print("%s%s", delimiter, LogDecorators::name(decorator)); - *delimiter = ','; - } - } + out->print("#" SIZE_FORMAT ": ", i); + _outputs[i]->describe(out); out->cr(); } } diff -r 8b8fd966478b -r 4974c8df2532 hotspot/src/share/vm/logging/logFileOutput.cpp --- a/hotspot/src/share/vm/logging/logFileOutput.cpp Sat Jul 09 19:20:38 2016 -0700 +++ b/hotspot/src/share/vm/logging/logFileOutput.cpp Wed Jul 06 20:58:08 2016 +0900 @@ -428,3 +428,13 @@ result[result_len] = '\0'; return result; } + +void LogFileOutput::describe(outputStream *out) { + LogOutput::describe(out); + out->print(" "); + + out->print("filecount=%u,filesize=" SIZE_FORMAT "%s", _file_count, + byte_size_in_proper_unit(_rotate_size), + proper_unit_for_byte_size(_rotate_size)); +} + diff -r 8b8fd966478b -r 4974c8df2532 hotspot/src/share/vm/logging/logFileOutput.hpp --- a/hotspot/src/share/vm/logging/logFileOutput.hpp Sat Jul 09 19:20:38 2016 -0700 +++ b/hotspot/src/share/vm/logging/logFileOutput.hpp Wed Jul 06 20:58:08 2016 +0900 @@ -85,6 +85,7 @@ virtual int write(const LogDecorations& decorations, const char* msg); virtual int write(LogMessageBuffer::Iterator msg_iterator); virtual void force_rotate(); + virtual void describe(outputStream *out); virtual const char* name() const { return _name; diff -r 8b8fd966478b -r 4974c8df2532 hotspot/src/share/vm/logging/logOutput.cpp --- a/hotspot/src/share/vm/logging/logOutput.cpp Sat Jul 09 19:20:38 2016 -0700 +++ b/hotspot/src/share/vm/logging/logOutput.cpp Wed Jul 06 20:58:08 2016 +0900 @@ -83,3 +83,18 @@ break; } } + +void LogOutput::describe(outputStream *out) { + out->print("%s ", name()); + out->print_raw(config_string()); + out->print(" "); + char delimiter[2] = {0}; + for (size_t d = 0; d < LogDecorators::Count; d++) { + LogDecorators::Decorator decorator = static_cast(d); + if (decorators().is_decorator(decorator)) { + out->print("%s%s", delimiter, LogDecorators::name(decorator)); + *delimiter = ','; + } + } +} + diff -r 8b8fd966478b -r 4974c8df2532 hotspot/src/share/vm/logging/logOutput.hpp --- a/hotspot/src/share/vm/logging/logOutput.hpp Sat Jul 09 19:20:38 2016 -0700 +++ b/hotspot/src/share/vm/logging/logOutput.hpp Wed Jul 06 20:58:08 2016 +0900 @@ -83,6 +83,8 @@ // Do nothing by default. } + virtual void describe(outputStream *out); + virtual const char* name() const = 0; virtual bool initialize(const char* options, outputStream* errstream) = 0; virtual int write(const LogDecorations& decorations, const char* msg) = 0;