On Fri, 13 Sep 2024 09:03:55 GMT, Antón Seoane <d...@openjdk.org> wrote:

> Hi all,
> 
> Currently, the Unified Logging framework defaults to three decorators 
> (uptime, level, tags) whenever the user does not specify otherwise through 
> `-Xlog`. This can result in cumbersome input whenever a specific user that 
> relies on a particular tag(s) has some predefined needs. For example, C2 
> developers rarely need decorations, and having to manually specify this every 
> time results inconvenient.
> 
> To address this, this PR enables the possibility of adding tag-specific 
> default decorators to UL. These defaults are in no way overriding user input 
> -- they will only act whenever `-Xlog` has no decorators supplied and there 
> is a positive match with the pre-specified defaults. Such a match is based on 
> the following:
> 
> - Inclusion: if `-Xlog:jit+compilation` is provided, a default for `jit` may 
> be applied.
> - Specificity: if, for the above line, there is a more specific default for 
> `jit+compilation` the latter shall be applied. Upon equal specificity cases, 
> both defaults will be applied.
> - Additionally, defaults may target a specific log level.
> 
> Decorators are also associated with an output file, so an output device may 
> only have one set of decorators. For this reason, if different 
> `LogSelection`s trigger defaults, none is to be applied.
> 
> In summary, these defaults may be seen as a "tailored" or "flavoured" version 
> of the existing "uptime-level-tags" current defaults.
> 
> Please consider this PR, and thanks!

Nice proposal, Antón! This will make it possible to migrate lots of 
debug/trace-level ad-hoc logging in the compiler code to the UL while 
preserving its current format (e.g. time decorators are hardly needed when 
examining the output of `-XX:+TraceLoopOpts`).

Having said this, I find the following behavior unintuitive. If I run:


-Xlog:jit*=debug


I get the global default decorators, i.e. `uptime,level,tags`, which is what I 
expected. But if I run:


java -Xlog:jit+compilation=debug,jit+inlining=debug,jit+thread=debug


I would expect to get the same decorators, but instead I get the default 
decorators for `jit+inlining`, i.e. none. Is this intentional?

In general, as a HotSpot developer the behavior I would find most natural is to 
select the union of all decorators for all chosen tags (regardless of whether 
the decorators for a tag have been chosen actively by the user, specified as 
default for the tag, or "inherited" from the global default), as in the first 
option (`-Xlog:jit*=debug`).

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

PR Comment: https://git.openjdk.org/jdk/pull/20988#issuecomment-2360164889

Reply via email to