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

Archiving doesn't work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.4
    • 2.4.1
    • Appenders
    • None
    • CentOS6.5

    • Patch

    Description

      Archiving doesn't work with DefaultRolloverStrategy as expected, the file (ending with either .zip or .gz) is being created with appropriate (zip, bz) extension but it's actually unzipped.

      The reason is that the ZipCompressAction expects the original file (to be compressed and deleted) without the zip extension, but the renaming action just renames it to the full name - with zip extension.

      I've fixed this issue for me (at DefaultRolloverStrategy .java) by replacing the

      final FileRenameAction renameAction =
      new FileRenameAction(new File(currentFileName), new File(renameTo), false);

      with

      //Remove the archive suffix from renameTo (created before archiving)
      String renameToBeforeCompress = compressAction==null?renameTo:renameTo.substring(0, renameTo.lastIndexOf('.'));

      final FileRenameAction renameAction =
      new FileRenameAction(new File(currentFileName), new File(renameToBeforeCompress), false);

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              alex_krasov Alex Krasov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: