RFR: 8229517: Support for optional asynchronous/buffered logging [v10]

Xin Liu xliu at openjdk.java.net
Wed May 5 06:23:54 UTC 2021


On Tue, 4 May 2021 15:47:01 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> I do not understand why you make the _tagset member in LogDecorations optional. Could you explain this?

The reason I change _tagset from reference to pointer because I would like tosupport tagset is NULL. 
This is a corner case.  When I inject meta-information, I don't have a appropriate tagset for the log message. 
[(null)               ]  is the result from LogDecorations with a NULL tagset. 


[24.933s][warning][(null)               ]   1983 messages dropped...
[24.943s][warning][(null)               ]   1424 messages dropped...
[24.953s][warning][(null)               ]   2067 messages dropped...
[24.964s][warning][(null)               ]   2466 messages dropped...
[24.972s][warning][(null)               ]   1635 messages dropped...


here is the relevant code snippet. 

bool AsyncLogMapIterator::do_entry(LogFileOutput* output, uintx* counter) {
  LogDecorators decorators = output->decorators();
  decorators.without(LogDecorators::tags_decorator);
  LogDecorations decorations(LogLevel::Warning, decorators);
  const int sz = 128;
  char out_of_band[sz];

  if (*counter > 0) {
    jio_snprintf(out_of_band, sz, UINTX_FORMAT_W(6) " messages dropped...", *counter);
    output->write_blocking(decorations, out_of_band);
    *counter = 0;
  }

  return true;
}

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

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


More information about the hotspot-dev mailing list