vy commented on code in PR #2242:
URL: https://github.com/apache/logging-log4j2/pull/2242#discussion_r1466422551


##########
log4j-core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java:
##########
@@ -614,15 +611,18 @@ public ReliabilityStrategy getReliabilityStrategy() {
      * Logs an event, bypassing filters.
      *
      * @param event     The log event.
-     * @param predicate predicate for which LoggerConfig instances to append 
to. A
-     *                  {@literal null} value is equivalent to a true 
predicate.
+     * @param dispatchType decides which logger configs should be used.
      */
-    protected void processLogEvent(final LogEvent event, final 
LoggerConfigPredicate predicate) {
+    protected void processLogEvent(final LogEvent event, final DispatchType 
dispatchType) {
         event.setIncludeLocation(isIncludeLocation());
-        if (predicate == null || predicate.allow(this)) {
+        if (hasDispatchType(dispatchType)) {
             callAppenders(event);
         }
-        logParent(event, predicate);
+        logParent(event, dispatchType);
+    }
+
+    protected boolean hasDispatchType(final DispatchType dispatchType) {
+        return dispatchType != DispatchType.ASYNCHRONOUS;

Review Comment:
   I am not able to follow the logic here. `hasDispatchType()` sounds like we 
will check if there are any dispatch types. Though we certainly don't do that. 
Plus, we only check if it is not async; again something I couldn't understand. 
Mind elaborating on what are you trying to do here? I was expecting something 
like `boolean dispatchTypeAllowed(DispatchType)`.
   
   Also, I am puzzled to see _async_ in `LoggerConfig`. `DispatchType` will 
still litter the `LoggerConfig` with `async` even if we split it into a 
separate module. Am I wrong? To avoid this, shouldn't `DispatchType` be a 
protected interface that integrators extend from instead?



##########
log4j-core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java:
##########
@@ -649,7 +649,7 @@ public boolean requiresLocation() {
         return false;
     }
 
-    private void logParent(final LogEvent event, final LoggerConfigPredicate 
predicate) {
+    private void logParent(final LogEvent event, final DispatchType predicate) 
{

Review Comment:
   Could you rename `predicate` to `dispatchType`, please?



-- 
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: notifications-unsubscr...@logging.apache.org

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

Reply via email to