little-hue opened a new issue, #3848:
URL: https://github.com/apache/logging-log4j2/issues/3848

   I’ve been researching per-request dynamic logging and came across a 
limitation in Log4j2’s filtering model compared to Logback.
   
   In Logback, the TurboFilter feature allows log events to be conditionally 
filtered before the logger’s level check is applied. This enables powerful use 
cases like enabling DEBUG logs for specific requests, even when the logger’s 
configured level is INFO.
   
   From my understanding and recent testing, Log4j2 does not currently support 
this behavior. Specifically:
   
   If a logger is configured at INFO, then all DEBUG messages are 
short-circuited before any Filter or ThreadContext logic is evaluated.
   
   As a result, it's not currently possible to emit DEBUG logs on a per-request 
basis using MDC or filters without globally lowering the logger level to DEBUG 
first.
   
   My question is:
   
   Are there any plans for Log4j2 to support pre-level-check filtering (similar 
to Logback’s TurboFilter), to allow dynamic log level evaluation per request or 
thread context?
   
   I understand this design may be for performance reasons, but it would be 
helpful to know if this kind of feature is on the roadmap or technically 
feasible within the current architecture.
   
   Thank you for your excellent work on Log4j2, and I appreciate your time and 
insights.
   
   Best regards,
   
   Amy
   


-- 
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.apache.org

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

Reply via email to