apache / apache/logging-log4j2

RollingRandomAccessFile uses wrong file name inside .zip

Open
#1,870 5 comments 0 reactions 0 assignees View on GitHub
appenders appenders:Rolling bug
Dominant language
Java
Stars
3.6k
Forks
1.7k
Avg merge
21h 30m
Merged PRs (30d)
27

Description

## Description
When using a RollingRandomAccessFile appender that zips the logs, and there are multiple threads really spewing logging, when log4j zip's the previous log file - it often uses the name of the current log file.

So, the base log file name is "stuff.log". Rolling every 100MB into stuff.%i.log.zip.
What I'm getting is stuff.1.log.zip contains stuff.7.log. All zips up to 7 contain stuff.7.log - though the actual log content is what is expected for stuff.1, or stuff.2, etc.. So the correct file is getting zipped - but given the wrong file name.

## Configuration

**Version:**
Log4j 2.21.0

**Operating system:** [OS and version]
Win 11

**JDK:** [JDK distribution and version]
Adoptium JDK-17.0.5+8

## Logs

## Reproduction







Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.