How to use log4j FileAppenders asynchronously?

I am working on a low latency trading application. We would like to increase the number of lof4j protocols that we write to the file, while minimizing the impact on our end-to-end processing time.

What is the recommended way to do this? I think FileAppender.append is synchronous, so we need to do something smarter than that ....

+7
source share
3 answers

Yes, adding synchronously. You want something like this:

http://www.spartanjava.com/2009/asynchronous-logging-with-log4j/

+8
source

If you need to log into a multi-threaded slf4j application and its logback implementation is the best choice.

+3
source

remember that AsyncAppender adds a stream to each incremental element and that increasing logging can mean a significant increase in string concatenation, which often means a significant amount of string processing / iterating / formatting which can be quite expensive (relative to latency associated with a low latency application )

+3
source

All Articles