Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-2394

Use RollingFileAppender by default in log4j.properties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Won't Do
    • None
    • 1.1.0
    • None

    Description

      The default log4j.properties bundled with Kafka uses ConsoleAppender and DailyRollingFileAppender, which offer no protection to users from spammy logging. In extreme cases (such as when issues like KAFKA-1461 are encountered), the logs can exhaust the local disk space. This could be a problem for Kafka adoption since new users are less likely to adjust the logging properties themselves, and are more likely to have configuration problems which result in log spam.

      To fix this, we can use RollingFileAppender, which offers two settings for controlling the maximum space that log files will use.

      maxBackupIndex: how many backup files to retain
      maxFileSize: the max size of each log file

      One question is whether this change is a compatibility concern? The backup strategy and filenames used by RollingFileAppender are different from those used by DailyRollingFileAppender, so any tools which depend on the old format will break. If we think this is a serious problem, one solution would be to provide two versions of log4j.properties and add a flag to enable the new one. Another solution would be to include the RollingFileAppender configuration in the default log4j.properties, but commented out.

      Attachments

        1. log4j.properties.patch
          4 kB
          Jin Xing

        Issue Links

          Activity

            People

              cotedm Dustin Cote
              hachikuji Jason Gustafson
              Jason Gustafson Jason Gustafson
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: