Add a log level check simply before logging. (#10093)
Motivation: ThrowableUtil.stackTraceToString is an expensive method call. So I think a log level check before this logging statement is quite needed especially in a environment with the warning log disabled. Modification: Add log level check simply before logging. Result: Improve performance in a environment with the warning log disabled.
This commit is contained in:
parent
dddde43dcf
commit
f07115c2a6
@ -65,7 +65,7 @@ public final class PromiseNotificationUtil {
|
|||||||
Throwable err = p.cause();
|
Throwable err = p.cause();
|
||||||
if (err == null) {
|
if (err == null) {
|
||||||
logger.warn("Failed to mark a promise as failure because it has succeeded already: {}", p, cause);
|
logger.warn("Failed to mark a promise as failure because it has succeeded already: {}", p, cause);
|
||||||
} else {
|
} else if (logger.isWarnEnabled()) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
"Failed to mark a promise as failure because it has failed already: {}, unnotified cause: {}",
|
"Failed to mark a promise as failure because it has failed already: {}, unnotified cause: {}",
|
||||||
p, ThrowableUtil.stackTraceToString(err), cause);
|
p, ThrowableUtil.stackTraceToString(err), cause);
|
||||||
|
Loading…
Reference in New Issue
Block a user