Details

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

      Window7
      apache-tomcat-7.0.39
      java1.7

      Description

      log4j2.xml:
      ...
      <FastRollingFile name="Media" fileName="$

      {medialog}.log"
      immediateFlush="true" filePattern="${medialog}

      -%d

      {MM-dd-yyyy}

      -%i.log">
      <PatternLayout>
      <pattern>%d [%t] [%-5level] [%F:%L] %msg%n
      </pattern>
      </PatternLayout>
      <Policies>
      <TimeBasedTriggeringPolicy />
      <SizeBasedTriggeringPolicy size="100 MB" />
      </Policies>
      </FastRollingFile>
      .....

      When log file created,like this:
      media-01-01-1970-1.log size:1KB
      media.log

      I set SizeBasedTriggeringPolicy 100 MB ,but the size of file "media-01-01-1970-1.log" is 1KB and time ends with file name is not right

        Issue Links

          Activity

          Hide
          fxc added a comment -

          org.apache.logging.log4j.core.appender.rolling.FastRollingFileManager
          method:createManager ,line:149
          problem line:173
          long time = file.lastModified();
          when file not exist,the time equals zero,so add code
          try

          { file.createNewFile(); }

          catch (final IOException ioe)

          { LOGGER.error("FastRollingFileManager:unable to create file " + name, ioe); return null; }

          before this line(173)

          Show
          fxc added a comment - org.apache.logging.log4j.core.appender.rolling.FastRollingFileManager method:createManager ,line:149 problem line:173 long time = file.lastModified(); when file not exist,the time equals zero,so add code try { file.createNewFile(); } catch (final IOException ioe) { LOGGER.error("FastRollingFileManager:unable to create file " + name, ioe); return null; } before this line(173)
          Hide
          Remko Popma added a comment - - edited

          Sorry, I missed your comment.

          This is the same issue as LOG4J-267. If append=false, the rollover time would be set to a long with value zero, which translates to Jan 1, 1970. I will commit the fix soon.

          Show
          Remko Popma added a comment - - edited Sorry, I missed your comment. This is the same issue as LOG4J-267. If append=false, the rollover time would be set to a long with value zero, which translates to Jan 1, 1970. I will commit the fix soon.
          Hide
          Remko Popma added a comment -

          Fixed in revision 1498044. Please verify and close.

          Show
          Remko Popma added a comment - Fixed in revision 1498044. Please verify and close.

            People

            • Assignee:
              Remko Popma
              Reporter:
              fxc
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 372h
                372h
                Remaining:
                Remaining Estimate - 372h
                372h
                Logged:
                Time Spent - Not Specified
                Not Specified

                  Development