hibernate-orm icon indicating copy to clipboard operation
hibernate-orm copied to clipboard

HHH-18204 - Add log level checks

Open jrenaat opened this issue 1 year ago • 3 comments

https://hibernate.atlassian.net/browse/HHH-18204

jrenaat avatar May 30 '24 14:05 jrenaat

Thanks for your pull request!

This pull request appears to follow the contribution rules.

› This message was automatically generated.

As far as I know, the usual reason we need to use isDebugEnabled() or isTraceEnabled() is that we're trying to avoid doing work in constructing the log message. If there's no work involved, the isDebugEnabled() call is just superfluous.

Yes, and it also clutters the code. I think we should focus these efforts on hot paths e.g. row reading, find/persist/remove ops.

beikov avatar May 31 '24 08:05 beikov

This was mainly just a quick-and-dirty effort to attempt to get a performance improvement where logging is concerned, as well as perhaps more consistency in checking the log level - right now we are very inconsistent wrt where the debug/trace check is being applied and where it is not, as well as in where debug and where trace is used. With this in mind I think it is better to have the check than not to have it, as far as debug/trace are concerned; wherever the log message is deemed important enough to not have such check is IMHO a candidate for a different log-level, such as INFO. Also in general, I tend to agree with @gavinking in that the vast majority of log msgs in the debug level are completely useless and could prob be removed. If this effort is considered useless, feel free to discard the PR and close the issue.

jrenaat avatar May 31 '24 12:05 jrenaat

Closing this since it's been sitting around forever and there doesn't seem to be consensus on its usefulness.

jrenaat avatar Nov 15 '24 19:11 jrenaat