-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TRACE logging improvements #12938
Comments
/cc @kenfinnigan, @Ladicek |
The solution described can be achieved by using gizmo to generate bytecode at build time for a class that substitutes |
Updated the description to better match the expected behaviour. PR incoming. |
* It enables log levels below that to be folded in native. * Runtime min-level has been removed (was deprecated already).
* It enables log levels below that to be folded in native. * Runtime min-level has been removed (was deprecated already).
* It enables log levels below that to be folded in native. * Runtime min-level has been removed (was deprecated already).
* It enables log levels below that to be folded in native. * Runtime min-level has been removed (was deprecated already).
Infinispan uses this idiom where it caches whether trace is enabled in a static final field. In native testing it has been shown that this field is true even if trace has not been enabled. @Sanne already predicted the issue. The linked issue also explains the reason why this happens. In Hibernate's case, they worked around it by making the cached field non static.
After much discussion, an agreement has been reached that
isTraceEanbled
calls should be computed at build time (only enable it if it has been configured) and if not enabled, all the code that adds/maintains trace logging should be dead code eliminated if possible. This way, for code that usesisTraceEnabled
to return true, it would require using a native executable that has been built with this option enabled. If this option was not enabled, the native executable would remove code toisTraceEnabled
true paths, reducing its size both in terms of code and strings used within it.Once this is in place, Hibernate could go back to having TRACE enabled check cached as static field and you could get the benefits above.The recommendation would be for instance or to use on the flyisTraceEnabled()
. By folding this colds, they'd precomputed at build time and replaced, so no need for static fields. In fact, static fields caching trace enabled should be avoided since they'll always return true.This change would require an update to the Quarkus logging documentation.
The text was updated successfully, but these errors were encountered: