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

Error creating rolling file with dated folder

    XMLWordPrintableJSON

Details

    Description

      I am trying to use the rolling appender to create a new log file each day in a dated folder. The initial file creation works fine but when the rollover is triggered a FileNotFound exception is thrown.

       

      Config:
      **
      <Appenders>
           <RollingFile  name="RollingFileAppender"
              filePattern="logDir/%d{yyyyMMdd}/processor.log">
            <PatternLayout> 
                  <Pattern>%d [%t] %-5level %logger{36}:%L - %msg%n%throwable</Pattern>
            </PatternLayout>
            <Policies>
                  <!-- the logs get rolled over into a date named log file every day (filePattern)-->
                  <TimeBasedTriggeringPolicyinterval="1"modulate="true"/>
             </Policies>
       
             <DirectWriteRolloverStrategy/>
         </RollingFile>

      </Appenders>
       
      looks like it could be an easy fix by adding a mkDirs call in createOutputStream() of FileManager class
       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              GrunenbergK Kevin Grunenberg
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: