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

FileAppender should permit lazy file creation

    XMLWordPrintable

Details

    • Icon: New Feature New Feature
    • Resolution: Won't Fix
    • Icon: Major Major
    • None
    • None
    • logback-core
    • None

    Description

      There should be an option to allow lazy file creation, so that the files are created only when an
      event has to be logged into it, and not when the appender starts.

      The main idea behind that is that I dislike seeing files like ERROR.log (or even worse CRASH.log !) in the log
      folders, even if their size is zero. And these files are probably even rolled over (at least with time based policy),
      which can generate many (empty and useless) files with frightening names.

      I think that something like
      <appender name="FILE" class="ch.qos.logback.core.FileAppender">
      <lazy>true</lazy>
      ...
      </appender>
      would be very convenient, as well as a way to globally set all file based appenders lazy (or not) at once:
      <configuration>
      <lazyFileAppenders/>
      </configuration>

      (or whatever people may find more convenient, maybe <FileAppenders lazy="true"/> )
      (because you may not want to add that on a dozen or more file appenders).

      This applies to all file appenders, including rolling ones, and maybe others ?

      BTW, the more I use logback the more impressed I am.
      You deserve a gold medal for your good job guys ! (and I don't give so many)

      Attachments

        Activity

          People

            logback-dev Logback dev list
            eestieve Eric Estievenart
            Votes:
            4 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: