vy commented on issue #57:
URL: 
https://github.com/apache/logging-log4j-kotlin/issues/57#issuecomment-1867522869

   Before answering your question, I have the impression that what you are 
after can be (and maybe should be?) done at the sink level. That is, assume 
your log sink is an Elasticsearch cluster. Why don't you count the calls there? 
If you can elaborate on your use case, I think we can help better.
   
   Extending loggers is not the way you intercept Log4j. You can implement 
either a [filter](https://logging.apache.org/log4j/2.x/manual/filters.html) or 
an [appender](https://logging.apache.org/log4j/2.x/manual/appenders.html) (that 
wraps your actual appender) and there you can extract statistics that suit your 
need.
   
   You can check out [`FailoverAppender` 
docs](https://logging.apache.org/log4j/2.x/manual/appenders.html#FailoverAppender)
 and 
[`FailoverAppender.java`](/apache/logging-log4j2/blob/2.x/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java)
 for inspiration.


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

Reply via email to