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

[2.7]about CrontriggeringPolicy to renaming old file

    XMLWordPrintableJSON

Details

    • Question
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.7
    • None
    • Appenders
    • None
    • Windows7 OS machine

    Description

      Hello:
      I tried CrontriggeringPolicy(added 2.7) for save log files at specific time.
      My goal is, for example.
      if now is 2017-01-04 18:00:00, "info.log" <- active file.
      and when 2017-01-04 18:01:00, "info.log" will be renamed "info.2017-01-04-18-00.log", and create new "info.log".
      But my problem is when 2017-01-04 18:01:00, "info.log" renamed "info.2017-01-04-17-59.log".
      I want to make that file's name "info.2017-01-04-18-00.log" because that file has 2017-01-04 18:00:00~2017-01-04 18:01:00's log,
      Here's my configure xml.

          <RollingFile name="infoFile" fileName="logs/info.log" filePattern="logs/info.%d{yyyy-MM-dd-HH-mm}.log" append="true" immediateFlush="true">
                  <PatternLayout>
                      <Pattern>%d %p\t%m%n</Pattern>
                  </PatternLayout>
                  <Policies>
                      <CronTriggeringPolicy schedule="0 */1 * * * ? *"/>
                  </Policies>
                  <Filters>
                      <ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL" />
                      <ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY" />
                  </Filters>
              </RollingFile>
      

      Please help me.
      Thanks for your help, I'm very appreciated it .

      Attachments

        Activity

          People

            Unassigned Unassigned
            xucheng xucheng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: