if (tbCleaner != null) {
tbCleaner.clean(new Date(getCurrentTime()));
}
}
and the fact that rolloverTargetIsParentFile is unused, it looks like the intent may have been to only archive the tempfile if the target and parent file names collide.
Anders Wallgren
added a comment - Based on this code:
boolean rolloverTargetIsParentFile() {
return (getParentsRawFileProperty() != null && getParentsRawFileProperty()
.equals(elapsedPeriodsFileName));
}
public void rollover() throws RolloverFailure {
// when rollover is called the elapsed period's file has
// been already closed. This is a working assumption of this method.
if(compressionMode == CompressionMode.NONE) {
if (getParentsRawFileProperty() != null) {
util.rename(getParentsRawFileProperty(), elapsedPeriodsFileName);
}
} else {
if(getParentsRawFileProperty() == null) {
doCompression(false, elapsedPeriodsFileName, elapsedPeriodsFileName);
} else {
doCompression(true, elapsedPeriodsFileName, elapsedPeriodsFileName);
}
}
if (tbCleaner != null) {
tbCleaner.clean(new Date(getCurrentTime()));
}
}
and the fact that rolloverTargetIsParentFile is unused, it looks like the intent may have been to only archive the tempfile if the target and parent file names collide.
Patch ch.qos.logback.core.rolling.helper.Compressor to use the name of the archive, minus ".zip" as the name of the zip entry, rather than the .tmp file.
Anders Wallgren
added a comment - A slightly different patch, based on 0.9.17.
Patch ch.qos.logback.core.rolling.helper.Compressor to use the name of the archive, minus ".zip" as the name of the zip entry, rather than the .tmp file.
Thank you for reporting and proving a patch for this issue. Your second patch has been applied with some adjustment. For the most part, it was right on. The only required change was the removal of any eventual folder prefix in the zipped file name. See also
Ceki Gulcu
added a comment - Thank you for reporting and proving a patch for this issue. Your second patch has been applied with some adjustment. For the most part, it was right on. The only required change was the removal of any eventual folder prefix in the zipped file name. See also
http://github.com/ceki/logback/commit/feba37d06ec4fc8398641b3056f32e1afdcb0bb4
boolean rolloverTargetIsParentFile() {
return (getParentsRawFileProperty() != null && getParentsRawFileProperty()
.equals(elapsedPeriodsFileName));
}
public void rollover() throws RolloverFailure {
// when rollover is called the elapsed period's file has
// been already closed. This is a working assumption of this method.
if(compressionMode == CompressionMode.NONE) {
if (getParentsRawFileProperty() != null) {
util.rename(getParentsRawFileProperty(), elapsedPeriodsFileName);
}
} else {
if(getParentsRawFileProperty() == null) {
doCompression(false, elapsedPeriodsFileName, elapsedPeriodsFileName);
} else {
doCompression(true, elapsedPeriodsFileName, elapsedPeriodsFileName);
}
}
if (tbCleaner != null) {
tbCleaner.clean(new Date(getCurrentTime()));
}
}
and the fact that rolloverTargetIsParentFile is unused, it looks like the intent may have been to only archive the tempfile if the target and parent file names collide.