Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-163

Create asynchronous Logger for low-latency logging



    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0-beta4
    • 2.0-beta5
    • None
    • None


      One of the main considerations for selecting a logging library is performance, specifically, how long it takes for a call to Logger.log to return. (See the comments of LOG4J-151 for a discussion of latency versus application throughput and logging throughput.)

      I believe it is possible to improve this performance by an order of magnitude by having an asynchronous Logger implementation that hands off the work to a separate thread as early as possible. The disk I/O would be done in this separate thread.

      AsynchAppender is not a good match for these requirements, as with that approach (a) the logging call still needs to flow down the hierarchy to the appender, doing synchronization and creating objects at various points on the way, and (b) when serializing the LogEvent, the getSource() method is always called, which is expensive.


        1. FastLog4j-v2-for-beta4.zip
          226 kB
          Remko Popma
        2. FastLog4j-v3-for-beta4.zip
          236 kB
          Remko Popma
        3. FastLog4j-v4-for-beta4.zip
          269 kB
          Remko Popma
        4. LOG4J2-163-log4j-async.patch
          308 kB
          Remko Popma
        5. LOG4J2-163-log4j-async-20130320.patch
          434 kB
          Remko Popma
        6. async-perf-comparison.png
          61 kB
          Remko Popma
        7. LOG4J2-163-log4j-async-20130331.patch
          487 kB
          Remko Popma
        8. LOG4J2-163-log4j-async-20130331-images.zip
          187 kB
          Remko Popma
        9. LOG4J2-163-log4j-async-20130331a.patch
          277 kB
          Remko Popma

        Issue Links



              rgoers Ralph Goers
              rpopma Remko Popma
              0 Vote for this issue
              3 Start watching this issue