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

Remove String.format from logger calls to improve performance #363

Merged
merged 5 commits into from
Dec 21, 2020

Conversation

Alexjsenn
Copy link
Contributor

Fixes #358
There are two or three statements where I left the String.format call because they had several arguments, and it probably doesn't make sense to create functions for that exact number of objects in cjfr-core.

@andrewazores
Copy link
Member

andrewazores commented Dec 17, 2020

they had several arguments, and it probably doesn't make sense to create functions for that exact number of objects in cjfr-core.

varargs? I believe the documentation specifies that this is how SLF4J does it - there are logger.log(String msg), logger.log(String msg, Object a), logger.log(String msg, Object a, Object b), and logger.log(String msg, Object... args) methods defined. We can do the same.

@Alexjsenn
Copy link
Contributor Author

they had several arguments, and it probably doesn't make sense to create functions for that exact number of objects in cjfr-core.

varargs? I believe the documentation specifies that this is how SLF4J does it - there are logger.log(String msg), logger.log(String msg, Object a), logger.log(String msg, Object a, Object b), and logger.log(String msg, Object... args) methods defined. We can do the same.

Should I add these methods for all of the logger message types even though some may not be used?

@andrewazores
Copy link
Member

They may not be used right now... IMO it only makes sense to make all of them consistent that way.

@Alexjsenn
Copy link
Contributor Author

yes, it makes sense, I added all the methods in cjfr-core, and changed the last string.format calls.

@andrewazores
Copy link
Member

Looks good. I manually rebased this and tested it myself and everything seems to continue working as expected. Please rebase this PR and I'll merge it.

@Alexjsenn Alexjsenn force-pushed the logger-string-format branch from df4ba4b to 86f8ef9 Compare December 18, 2020 17:44
@andrewazores andrewazores merged commit 999edfb into cryostatio:main Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't use String.format inside log statements
2 participants