RFR: 8229517: Support for optional asynchronous/buffered logging

Xin Liu xliu at openjdk.java.net
Thu Mar 25 19:00:32 UTC 2021


On Thu, 25 Mar 2021 12:42:34 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:

> 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
> ```

hi, @YaSuenag, 

Thank you for providing the stacktrace! I didn't notice <logMessage.hpp> until you point out. Now I understand the rationale and usecases of logMessageBuffer. Let me figure out how to support it. 

IIUC, the most important attribute of `LogMessage` is to guarantee messages are consecutive, or free from interleaving. I will focus on it.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3135


More information about the hotspot-dev mailing list