alievmirza commented on a change in pull request #217:
URL: https://github.com/apache/ignite-3/pull/217#discussion_r673837921
##########
File path: modules/core/src/main/java/org/apache/ignite/lang/IgniteLogger.java
##########
@@ -195,7 +201,12 @@ private void logInternal(Level level, String msg,
Object... params) {
if (!log.isLoggable(level))
return;
- log.log(level, LoggerMessageHelper.arrayFormat(msg, params));
+ Throwable throwable =
LoggerMessageHelper.getThrowableCandidate(params);
+
+ if (throwable != null)
+ log.log(level, LoggerMessageHelper.arrayFormat(msg,
LoggerMessageHelper.trimmedCopy(params)), throwable);
+ else
+ log.log(level, LoggerMessageHelper.arrayFormat(msg, params));
Review comment:
> Compatibility. Slf4J hadn't supported this case. So, no compatibility
is broken.
I couldn't agree with you. The only reason why I decided to support such
methods is that Slf4J supports throwable as the last param [1] and it is widely
used in Jraft module (for example [2]). So, most logic with checking the last
param was taken from Slf4J library [3]. As far as I can understand, the current
API was changed by @vldpyatkov and it is a subset of Slf4J API. We use
`LoggerMessageHelper` [4] and this class is very close to `MessageFormatter`
from Slf4J [5]
So, I would say, that my implementation should be approved, as far as it
preserves logic from Slf4J
[1]
https://github.com/qos-ch/slf4j/blob/975a9a1e7e15e1e9ab8b34487aecba15048a7ded/slf4j-api/src/main/java/org/slf4j/helpers/AbstractLogger.java#L397
[2]
https://github.com/apache/ignite-3/blob/96067912780385940b3db432f3af1d89531233cf/modules/raft/src/main/java/org/apache/ignite/raft/jraft/storage/impl/LocalLogStorage.java#L229
[3]
https://github.com/qos-ch/slf4j/blob/master/slf4j-api/src/main/java/org/slf4j/helpers/MessageFormatter.java#L155
[4]
https://github.com/apache/ignite-3/blob/96067912780385940b3db432f3af1d89531233cf/modules/core/src/main/java/org/apache/ignite/lang/LoggerMessageHelper.java#L95
[5]
https://github.com/qos-ch/slf4j/blob/975a9a1e7e15e1e9ab8b34487aecba15048a7ded/slf4j-api/src/main/java/org/slf4j/helpers/MessageFormatter.java#L178
--
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]