https://issues.apache.org/bugzilla/show_bug.cgi?id=56019
Bug ID: 56019
Summary: RollingFileAppender not working if destination
directory does not exists
Product: Log4j
Version: 1.2.17
Hardware: PC
OS: Windows XP
Status: NEW
Severity: minor
Priority: P2
Component: Other
Assignee: [email protected]
Reporter: [email protected]
I am using RollingFileAppender with TimeBasedRollingPolicy. I'd like backup
files to be saved in a different folder than the current one.
The problem I am having, is that it only works when destination directory of
backup files is already created. When backup directory does not exists, then
rollover is skipped.
I debugged code and realized that the problem may be solved if the backup
folder is created in FileRenameAction
Just change the method execute in FileRenameAction to:
public static boolean execute(
final File source, final File destination, boolean renameEmptyFiles) {
if (renameEmptyFiles || (source.length() > 0)) {
File destinationParent = destination.getParentFile();
if (!destinationParent.exists()) {
destinationParent.mkdirs();
}
return source.renameTo(destination);
}
return source.delete();
}
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]