You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2014/01/16 13:54:11 UTC
[Bug 56019] New: RollingFileAppender not working if destination
directory does not exists
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: log4j-dev@logging.apache.org
Reporter: roberjruiz@yahoo.es
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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org