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

Garbage-free steady-state logging



    • GC-free


      In certain fields like finance, predictable latency is very important, and applications in this space tend to carefully manage their object allocation to avoid unpredictable GC pauses. As of 2.5, Log4j is not suitable to be included in such applications since it allocates new objects while running in its steady state.

      This ticket is to investigate the feasibility of modifying some key components in Log4j to provide a configuration that does not allocate new objects in its steady state. (Initialization or shutdown don't need to be allocation-free.)

      To clarify, I am not proposing to make all of Log4j allocation-free. My goal is to create an allocation-free execution path in Log4j with some reasonable subset of the Log4j functionality. For example, make logging garbage-free if all of these conditions are met:

      • all loggers are AsyncLoggers
      • you only use the RandomAccessFileAppender
      • you only use a PatternLayout without any regular expression replacements, without lookups and with one of the pre-defined date formats.

      Further restrictions may be necessary.


      The scope has been expanded to

      • include both synchronous and asynchronous loggers
      • include the most common appenders: console, file and random access file appender (both with rolling variants)

      The tickets below list separate pieces of work necessary to accomplish this.


        Issue Links



              Unassigned Unassigned
              rpopma Remko Popma
              2 Vote for this issue
              9 Start watching this issue