Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log4j 2.x - RollingRandomAccessFileAppender missing "createOnDemand" attribute (although documented as valid) #3083

Open
JWT007 opened this issue Oct 14, 2024 · 1 comment
Labels
appenders:Rolling Affects log file rolling functionality enhancement Additions or updates to features

Comments

@JWT007
Copy link
Contributor

JWT007 commented Oct 14, 2024

In the new Log4j 2.x online documentation:

https://logging.apache.org/log4j/2.x/manual/appenders/rolling-file.html

The configuration attribte 'createOnDemand' is documented as a common attribute for both RollingFileAppender and RollingRandomAccessFileAppender.

Looking at most current code (2.24.1) it seems to only be an attribute of the RollingFileAppender.

NOTE: I originally created a ticket for this on the JIRA to which @ppkarwasz mentioned that this is probably a bug.
https://issues.apache.org/jira/browse/LOG4J2-3690

If so, I assume that the attribute needs to be duplicated in RollingRandomAccessFileAppender.

Reading the documentation and looking at the code it almost seems like there is a missing link in the inheritence chain :)

class AbstractRollingFileAppender extends AbstractOutputStreamAppender

@ppkarwasz ppkarwasz added enhancement Additions or updates to features appenders:Rolling Affects log file rolling functionality labels Oct 14, 2024
@ppkarwasz
Copy link
Contributor

@JWT007,

Thanks for reporting this.

Although we could solve this with a documentation update, I am classifying this as a feature request. Without discussing the merit of the createOnDemand configuration attribute itself, I find the lack of this feature in many variants of the file and rolling file appenders a bug.
Personally I consider all those plugins as variants of either the File Appender or the RollingFile Appender. Generic features like createOnDemand should be introduced to all 5 plugins (or none at all 😉).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
appenders:Rolling Affects log file rolling functionality enhancement Additions or updates to features
Projects
None yet
Development

No branches or pull requests

2 participants