bailan opened a new issue, #1569:
URL: https://github.com/apache/logging-log4j2/issues/1569
I like using {}-style parameters in logging messages. I am so used to adding
the throwable as the last parameter, so it will be handled by the logging API
automatically (adding the exception and stack traces to the final log).
I realized recently that not everyone knows about this feature, and I got
into an argument of if the use of the API was correct or not. Specifically,
there was a suspect if the exception would be print out if we don't specific
that in the log message as follows
```
log.error("Failed!", exception) -> log.error("Failed! Here is the exception
{}", exception)
```
I couldn't find any official documents (Javadoc, Wiki) talking about this
feature other than this [stackoverflow answer](
https://stackoverflow.com/questions/35096746/substituting-parameters-in-log-message-and-add-a-throwable-in-log4j-2).
It seems to me that it makes sense to make this feature explicit in the
Javadoc, for example
[here](https://github.com/apache/logging-log4j2/blob/2.x/log4j-api/src/main/java/org/apache/logging/log4j/Logger.java#L748),
so it is clearer to the user how the logger would/should handle the throwable
as the last parameter.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]