Pil0tXia commented on code in PR #4698:
URL: https://github.com/apache/eventmesh/pull/4698#discussion_r1438494674
##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/file/WatchFileManager.java:
##########
@@ -62,10 +60,10 @@ private static void shutdown() {
return;
}
- LogUtils.info(log, "[WatchFileManager] start close");
+ log.atInfo().log("[WatchFileManager] start close");
Review Comment:
1.
- Better performance:
>The additional `isDebugEnabled()` check before `log.debug()` is performed
in order to avoid invoking the methods referenced in the `message` field, thus
improving logging performance. For example:
>
>```java
>log.debug("formatted msg: {}", formatMsg(rawMsg));
>```
>
>Even when the log level is set to `info`, the `formatMsg(rawMsg)` method
will still be called and return a result before being passed as an argument to
`log.debug()`. This takes time.
- Scenarios where Fluent Logging API is unnecessary:
>Only the scenario mentioned in the Background Knowledge section require the
use of Fluent Logging API. For example, in the case of the changes in `Codec`
class L224, where no object parameters are passed or existing objects are
referenced, there is no additional performance overhead, and there is no need
to pre-evaluate log levels. The `log.debug()` usage can be directly applied.
There are many places where the usage of `ifDebugEnabled` is a remnant from
the log4j era, which can be replaced with `log.debug()` from slf4j. However, in
many cases, removing the `ifDebugEnabled` directly would result in a
performance decrease.
---
有不少地方的`ifDebugEnabled`是log4j时代残留的用法,可以用slf4j的`log.debug()`代替。不过也有很多地方,直接去掉`ifDebugEnabled`的话,是会降低性能的。
2.
That requires obtaining the Fully Qualified Class Name (FQCN) of each class
and passing it as a parameter to LogUtils, which is not a good approach for us.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]