ppkarwasz commented on issue #3527:
URL: 
https://github.com/apache/logging-log4j2/issues/3527#issuecomment-2716983252

   > Is this CustomFilter run in LogEvent consumer side or producer side? It 
could introduce performance workload if filter logic is performed at consumer 
side, as far as I known LogEvent creation is using multiple threads, but 
consumer is single thread.
   
   Yes, the **global** filter (direct child of the `<Configuration>` element) 
is always executed on the producer thread, never on the consumer thread. It is 
executed **before** a `LogEvent` is created:
   
   
https://github.com/apache/logging-log4j2/blob/5864c9acd6601b0385d4280ceb40fb1d9834f9fd/log4j-core/src/main/java/org/apache/logging/log4j/core/Logger.java#L193-L196
   
   
https://github.com/apache/logging-log4j2/blob/5864c9acd6601b0385d4280ceb40fb1d9834f9fd/log4j-core/src/main/java/org/apache/logging/log4j/core/Logger.java#L543-L552
   
   Filters can also appear in other parts of a configuration, as children of 
[loggers](https://logging.apache.org/log4j/2.x/manual/configuration.html#configuring-loggers),
 [appender 
references](https://logging.apache.org/log4j/2.x/manual/configuration.html#configuring-appenderrefs)
 or appenders. Those are executed on the consumer thread and have an 
increasingly higher overhead, especially for messages that are discarded.


-- 
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