-
Notifications
You must be signed in to change notification settings - Fork 38k
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
Spring logging support enhancement #22726
Comments
Note that in 5.1 we added |
@rstoyanchev I've considered that already but since this is really about From my perspective, those pieces complement each other quite nicely. |
@garyrussell FYI, in my local tests, the
Note that |
Sounds good; thanks. |
@jhoeller, when I introduced similar log message Although that contradicts conventional API design practices whereby optional arguments (in this case a What do you think about switching the order of those arguments in methods in the new |
@sbrannen Good point indeed! Given that the order of arguments for the |
SGTM. |
Reopening for printf-style format string support in My current implementation turns |
I wonder if we should consider renaming the logger.debug(LogMessage.of(() -> "foo" + "bar"))` That might also work for the logger.debug(LogMessage.of("%s %s", foo, bar)) |
As for import static org.springframework.core.log.LogMessage.format;
logger.debug(format("%s %s", foo, bar)); |
Indeed, I wasn't too sure on renaming |
Hi Juergen, I wonder if you would consider adding I can see 2 use cases...
Thoughts? Thanks |
Affects: 5.2.x
Many Spring projects use the pattern
To avoid evaluating
<someSpringExpression>
(often aStringBuilder
) unless the level is enabled.With the advent of lambdas, this code could be simpler, using
Supplier
...or
After some discussion with Juergen, a couple of options emerged...
The text was updated successfully, but these errors were encountered: