apache / apache/logging-log4cxx
FileAppender creates empty log files before any message is written
- Dominant language
- C++
- Stars
- 301
- Forks
- 142
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 29
Description
### Description
`FileAppender` currently opens its `FileOutputStream` during initialization. This creates the log file, and potentially its parent directory, even when no log message is ever written.
The file should be created only when the first message is logged. Existing behavior should otherwise be preserved:
- Append mode keeps existing contents.
- Non-append mode truncates an existing file so logging starts fresh.
- If no message is written, no new empty log file should be created.
The proposed fix is to open `FileOutputStream` lazily from `write()` instead of opening it during appender configuration.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the FileAppender initialization and write() entry point described in the issue, then trace how FileOutputStream is currently opened. Verify append mode preserves existing contents, non-append mode truncates as before, and that an appender which receives no message creates neither a file nor its parent directory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100