You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/09/08 07:55:43 UTC

[GitHub] [pulsar] lhotari commented on a change in pull request #11963: [Issue #11799][logging] PIP-89: Enum based logging

lhotari commented on a change in pull request #11963:
URL: https://github.com/apache/pulsar/pull/11963#discussion_r704146074



##########
File path: structured-event-log/src/main/java/org/apache/pulsar/structuredeventlog/slf4j/Slf4jEvent.java
##########
@@ -160,7 +166,15 @@ public void log(String event) {
                 MDC.put("startTimestamp", startTime.toString());
                 MDC.put("durationMs", String.valueOf(Duration.between(startTime, clock.instant()).toMillis()));
             }
-            Logger logger = LoggerFactory.getLogger("stevlog");
+            Logger logger;
+            if (component != null) {
+                MDC.put("component", component);
+                logger = LoggerFactory.getLogger(
+                        new StringBuilder("stevlog.").append(component)
+                        .append(".").append(event).toString());

Review comment:
       If this part of the code is a hotspot, it would be better if the logging code is mostly "garbage free". Would it be possible to refactor this so that the logger name isn't created for each call and looked up?




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org