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

RandomAccessFileAppender does not write headers

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.14.1
    • None
    • Appenders
    • None

    Description

      When using a `RandomAccessFileAppender` with a layout that includes a header/footer (e.g., a `JsonLayout` with complete=true), the header is not written to the file. 

      This seems to be due to `OutputStreamManager.writeHeader` directly writing to the output stream using `os.write` rather than invoking `writeToDestination`. Since the output stream is a `NullOutputStream` when the manager is a RandomAccessFileManager, nothing gets written.

      This makes generating complete JSON files in a RandomAccessFileAppender impossible. 

      Attachments

        Activity

          People

            Unassigned Unassigned
            spock_yh Yair Halevi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: