RFR: 8229517: Support for optional asynchronous/buffered logging
Yasumasa Suenaga
ysuenaga at openjdk.java.net
Thu Mar 25 12:45:40 UTC 2021
On Mon, 22 Mar 2021 22:12:14 GMT, Xin Liu <xliu at openjdk.org> wrote:
> This patch provides a buffer to store asynchrounous messages and flush them to
> underlying files periodically.
I think this PR is very useful for us!
> May we know more about LogMessageBuffer.hpp/cpp? We haven’t found a real use of it. That’s why we are hesitating to support LogFileOutput::write(LogMessageBuffer::Iterator msg_iterator). Further, we haven’t supported async_mode for LogStdoutOutput and LogStderrOutput either. It’s not difficult but needs to big code change.
`LogMessageBuffer` is used in `LogMessage`. For example, we can see it as following. Frame # 1 is `LogFileOutput::write(LogMessageBuffer::Iterator msg_iterator)`. IMHO we do not need to change LogStdout/errOutput, but it is better to change LogMessageBuffer.
#0 LogFileStreamOutput::write (this=this at entry=0x7ffff0002af0, msg_iterator=...)
at /home/ysuenaga/github-forked/jdk/src/hotspot/share/logging/logDecorators.hpp:108
#1 0x00007ffff6e80e8e in LogFileOutput::write (this=this at entry=0x7ffff0002af0, msg_iterator=...)
at /home/ysuenaga/github-forked/jdk/src/hotspot/share/logging/logFileOutput.cpp:314
#2 0x00007ffff6e876eb in LogTagSet::log (
this=this at entry=0x7ffff7d4a640 <LogTagSetMapping<(LogTag::type)16, (LogTag::type)68, (LogTag::type)0, (LogTag::type)0, (LogTag::type)0, (LogTag::type)0>::_tagset>, msg=...) at /home/ysuenaga/github-forked/jdk/src/hotspot/share/logging/logTagSet.cpp:85
#3 0x00007ffff6a194df in LogImpl<(LogTag::type)16, (LogTag::type)68, (LogTag::type)0, (LogTag::type)0, (LogTag::type)0, (LogTag::type)0>::write (
msg=...) at /home/ysuenaga/github-forked/jdk/src/hotspot/share/logging/logTagSet.hpp:150
#4 LogMessageImpl<(LogTag::type)16, (LogTag::type)68, (LogTag::type)0, (LogTag::type)0, (LogTag::type)0, (LogTag::type)0>::flush (
this=0x7ffff58675d0) at /home/ysuenaga/github-forked/jdk/src/hotspot/share/logging/logMessage.hpp:79
#5 LogMessageImpl<(LogTag::type)16, (LogTag::type)68, (LogTag::type)0, (LogTag::type)0, (LogTag::type)0, (LogTag::type)0>::~LogMessageImpl (
this=0x7ffff58675d0, __in_chrg=<optimized out>) at /home/ysuenaga/github-forked/jdk/src/hotspot/share/logging/logMessage.hpp:74
#6 InstanceKlass::print_class_load_logging (this=this at entry=0x800007430, loader_data=loader_data at entry=0x7ffff00f5200,
module_entry=module_entry at entry=0x0, cfs=cfs at entry=0x0) at /home/ysuenaga/github-forked/jdk/src/hotspot/share/oops/instanceKlass.cpp:3647
src/hotspot/share/runtime/globals.hpp line 2033:
> 2031: "Milliseconds between asynchronous log flushing") \
> 2032: \
> 2033: product(bool, AsyncLogging, false, \
I think this option is not needed - `async` should be set to `false` by default, and we should control it through `-Xlog` option like other log output options (e.g. `filecount`).
src/hotspot/share/runtime/globals.hpp line 2036:
> 2034: "Enble asynchronous GC logging") \
> 2035: \
> 2036: product(size_t, GCLogBufferSize, 2*K, \
This PR is for UL, not only GC log. So it should be renamed.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3135
More information about the hotspot-dev
mailing list