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

RollingRandomAccessFile appender loses output when fileName/filePattern accesses ${sys:property}

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta9
    • Fix Version/s: 2.0-rc1
    • Component/s: Appenders
    • Labels:
    • Environment:

      Windows 7, JDK 1.7.25

      Description

      Using sample config for RollingRandomAccessFile, with log name retrieved from enviroment variable "Fubar"...

          <RollingRandomAccessFile name="RollingRandomAccessFile" 
              fileName="logs/${sys:Fubar}.log"
              filePattern="logs/$${date:yyyy-MM-dd}/${sys:Fubar}-%d{MM-dd-yyyy}-%i.log.gz">
      

      Along with a harness program,

          public static void main(String[] args) {
              for (int i=0; i < 100000; i++) {
                  logger.info("Logger writes message for the nth time " + i);
              }
              System.out.println("Done");
          }
      

      If I use ${sys:Fubar}, instead of, say a literal value, the contents of the first rolled file are lost. I had SizeBasedTriggeringPolicy set to 1 MB, meaning, 21296 log messages were lost.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rpopma Remko Popma
                Reporter:
                bheadley2 bryan headley
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: