Skip to content
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

Proposal: Remove varargs from log methods #16030

Closed
nik9000 opened this issue Jan 15, 2016 · 0 comments · Fixed by #20235
Closed

Proposal: Remove varargs from log methods #16030

nik9000 opened this issue Jan 15, 2016 · 0 comments · Fixed by #20235
Assignees
Labels
:Core/Infra/Logging Log management and logging utilities >enhancement v5.0.0-beta1

Comments

@nik9000
Copy link
Member

nik9000 commented Jan 15, 2016

While varargs are convenient they allocate. That isn't usually a big deal but in the case of disabled log messages you'd prefer not to incur that penalty. My proposal is to remove the varargs from all log method, or at least the ones less than warning, and replace them with explicit 1, 2, and 3 argument versions. Those won't allocate at all except for boxing. Then create a version of the log methods that takes an array rather than varargs so that you have to intentionally allocate the array.

This should reduce the need for if (logger.isDebugEnabled()) style checks while at the same time making it more clear when a log invocation allocates. It'll still be possible to hide allocations in log invocations, just a little bit harder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Logging Log management and logging utilities >enhancement v5.0.0-beta1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants