Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1617

Write logging file name with date pattern

    XMLWordPrintable

Details

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • logback-core
    • None

    Description

      I wanted to use logback to include the date in logging file name, but I couldn't find the way with the code already developed.
      Like log4j2, I wanted RollingFileAppender to have a class that works with `DirectWriteRolloverStrategy`, but it didn't exist.
       
      The contents I wanted to do are as follows.

      log file in now(today) -> log_file.2022-02-28
      log file in next day   -> log_file.2022-03-01
      the next two days      -> log_file.2022-03-02
      

       
       
      Unlike the existing `RollingFileAppender`, it's a structure in which a new file with a date is created, not a file rename.
      This way is necessary for situations in which a problem may occur when rotating a file.
       
      To solve this problem which is caused by file rotation, I has developed a new 'DateNameFileAppender'.
       
      Is there a way to solve it with the existing code that I couldn't find?

      While waiting for an answer to the above question, I'm going to pull-request on github.
       

      Attachments

        Activity

          People

            logback-dev Logback dev list
            wshid wshid
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: