8340363: Tag-specific default decorators for UnifiedLogging

Roberto Castaneda Lozano roberto.castaneda.lozano at oracle.com
Fri Sep 27 13:18:08 UTC 2024


Hi Antón, thanks for starting this discussion.

Let me summarize your latest proposal to see if I get it right (please correct me otherwise):

- 1) If the user selects a certain set of decorators through the Xlog command, that set is used to decorate all UL output lines.

- 2) Otherwise (no user-selected set of decorators): if the user selects at least one tag is *not* configured as no-decorators-by-default, the current default decorators (uptime, level, tag set) are applied to decorate *all* UL output lines.

- 3) Otherwise (no user-selected set of decorators, and all selected tags are configured as no-decorators-by-default): no UL output line is decorated (equivalent to -Xlog:(...)::none).

As a C2 developer, I think this behavior strikes a good balance between good compiler tracing/debugging ergonomics (where we usually have no need for decorators) and preserving the current behavior for all other use cases. It would support migrating flags such as e.g. TraceLoopOpts, which usually have no need for decorators, to the UL framework and getting the exact same output as today with as simple line like -Xlog:jit+loopopts or similar (the user can always select decorators actively if needed). At the same time, it would preserve the UL behavior for all users of the existing GC and runtime tags which are *not* marked as no-decorators-by-default, even if these tags are selected in combination with future compiler tags marked as no-decorators-by-default.

Cheers,

Roberto

________________________________________
From: hotspot-dev <hotspot-dev-retn at openjdk.org> on behalf of Anton Seoane Ampudia <anton.seoane.ampudia at oracle.com>
Sent: Friday, September 27, 2024 11:07 AM
To: hotspot-dev at openjdk.org
Subject: 8340363: Tag-specific default decorators for UnifiedLogging

Hi all,

Currently, the Unified Logging framework defaults to three decorators (uptime, level, tags) whenever the user does not specify otherwise through -Xlog. This results sometimes inconvenient when specific users with some predefined needs do not want those tags. For example, C2 developers would rather not see those defaults in cases such as jit+inlining, but also do not want to specify so every time they run -Xlog.

One solution for this is found in this PR: https://github.com/openjdk/jdk/pull/20988. It can be considered as a “flavoured” version of the existing default decorators and in no way it will override anything user-specified. Also, decorators will still be consistent throughout an output device (i.e., no different decorators “mixed in”).

However, upon recent talks with different teams this approach may be too flexible/powerful. The ability of specifying LogSelection-bound default decorators may result in a situation where defaults for A+B and C+D have been specified, and a user selects -Xlog:A+B,C+D. In that case, the union of the prespecified defaults is taken, which may not be what the end user wants (and might result in too many decorators).

Actually, the main use case for this that I know as of now is C2 developers and the wish to not see decorators for some defined log selections. With this in mind, I have reduced the original idea to a feature where only the default decorators are not shown if we get a positive match with a prespecified list throughout the entire user log selection list (i.e.:

  *   If there is a default for A+B and the user specifies -Xlog:A+B,C+D, he will still get the default decorators
  *   If there is a default for A+B and the user specifies -Xlog:A+B, no default decorators will be supplied).

Before scraping the original idea and moving on with this one (which will not change anything as it is right now, except for the really specific uses like C2 jit+inlining that may be decided), I wanted to get a broader idea of people’s opinions on this, as well as other use cases for this behaviour.

Many thanks,
Antón


More information about the hotspot-dev mailing list