Request For Comment: Asynchronous Logging

Ioi Lam ioi.lam at oracle.com
Mon Apr 5 18:36:46 UTC 2021



On 3/31/21 5:16 PM, Yasumasa Suenaga wrote:
> On 2021/04/01 4:10, Thomas Stüfe wrote:
>>
>> I prefer to keep "async" a global option. I think we should expose as 
>> little freedom to the user as possible. I do not think there is a 
>> sensible scenario where one would wish to write to one file with 
>> async, to another file without async. Nevertheless, if we make this 
>> option target-specific this has to work, and perform, and be 
>> regression-tested in all its variations. Every option we roll out is 
>> a contract we have to fulfill. They find their way into all kinds of 
>> environments and user scripts, and once out there it is difficult to 
>> roll out incompatible changes. For instance,  there is no mechanism 
>> to deprecate a part of an option. We have a mechanism for deprecating 
>> normal VM options, but Xlog is not a  normal option.
>
> I don't like to keep "async" a global option because other -Xlog 
> options (e.g. filecount) does not global.
> It might break consistency for -Xlog options.
>

There is actually one global Xlog option today:

     java -Xlog:disable ....

For async logging, I would prefer a global option like

     java -Xlog:async -Xlog:gc=gc.txt -Xlog:metaspace=metaspace.txt

I think we should expand the set of global Xlog options when appropriate.

To take this further (maybe in a separate RFE), having a global file 
option will be useful. It's a pain to specify the same file many times, 
especially if you don't want the log file rotation:

     java  -Xlog:gc=log.txt:none:filesize=0 
-Xlog:metaspace=log.txt:none:filesize=0 ...

Yes, you can put all of the logs into a single command-line argument, like

     java  -Xlog:gc,metaspace:file=log.txt:none:filesize=0

but that will be difficult if you have a script that builds the 
command-line conditionally.

So, if we now add a new "async" option for each file, it will make 
things even more unmanageable.

Instead, something like this will be much easier to use:

     java  -Xlog:file=log.txt -Xlog:gc -Xlog:metaspace
     java  -Xlog:file=log.txt -Xlog:gc -Xlog:metaspace -Xlog:async

Thanks
- Ioi


More information about the hotspot-dev mailing list