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

Log4j 1.x 2.17.2 bridge - Does standard RollingFileAppender supports multiple process writing to same log file at the same time??



    • Question
    • Status: Resolved
    • Major
    • Resolution: Information Provided
    • 2.17.2
    • None
    • Log4j 1.2 bridge
    • None


      In our application we require a rolling file appender which can be used across multiple processes targeting the same file.

      I wanted to check if current log4j1.x 2.17.2 bridge version supports multi process rolling file appender, if not then is there any plan to support this feature in future releases??

      For reference, as per our application requirement, I am attaching sample java class files for custom appender, custom multi process rolling appender, sample test program with multiple threads for which we can run multiple instances to test multi process rolling and log4j property file.CustomLogger.javaJavaLoggingMultiThTest.javacustomlog.properties 

      In one of the mail chain to group Log4J Users List <log4j-user@logging.apache.org>,  ralphgoers pointed out that "FWIW the Log4j 2 RollingFileAppender does not support being used across multiple processes targeting the same file either. I’d love to know how you avoided having the file roll multiple times (once for each process)".


        1. CitedText-RollingFileAppenderNoSupportForMultProcessWritingToSameFile.PNG
          54 kB
          Pooja Pandey
        2. customlog.properties
          1 kB
          Pooja Pandey
        3. CustomLogger.java
          12 kB
          Pooja Pandey
        4. CustomLoggerFactory.java
          0.3 kB
          Pooja Pandey
        5. CustomMultiProcessRollingAppender.java
          30 kB
          Pooja Pandey
        6. JavaLoggingMultiThTest.java
          4 kB
          Pooja Pandey



            pkarwasz Piotr Karwasz
            PoojaTheCoder Pooja Pandey
            0 Vote for this issue
            3 Start watching this issue