
|
If you were logged in you would be able to see more operations.
|
|
|
logback-core
Created: 20/Mar/10 12:13 AM
Updated: 20/Mar/10 12:13 AM
|
|
| Component/s: |
Appender
|
| Affects Version/s: |
0.9.18
|
| Fix Version/s: |
None
|
|
|
It would be nice to have the option of having the SizeAndTimeBasedFNATP always create a new file on a restart (only applicable when <File> is not specified -- only the <FileNamePattern>). Currently, if a process locks the latest file while the appender is stopped, then the FileAppender.openFile will fail if the file is still locked when the appender starts again.
I'm currently accomplishing this by overriding SizeAndTimeBasedFNATP.start and using reflection to increment the currentPeriodsCounter.
If a boolean option (e.g. "newFileOnStart") was added to SizeAndTimeBasedFNATP and computeCurrentPeriodsHighestCounterValue was modified to return whether or not a matching file was found, then the start method could be modified as shown below:
if (tbrp.getParentsRawFileProperty() == null) {
String regex = tbrp.fileNamePattern.toRegex(dateInCurrentPeriod);
String stemRegex = FileFilterUtil.afterLastSlash(regex);
// beginning of changes
boolean fileExists = computeCurrentPeriodsHighestCounterValue(stemRegex);
if (fileExists && newFileOnStart) {
currentPeriodsCounter++;
}
// end of changes
}
|
|
Description
|
It would be nice to have the option of having the SizeAndTimeBasedFNATP always create a new file on a restart (only applicable when <File> is not specified -- only the <FileNamePattern>). Currently, if a process locks the latest file while the appender is stopped, then the FileAppender.openFile will fail if the file is still locked when the appender starts again.
I'm currently accomplishing this by overriding SizeAndTimeBasedFNATP.start and using reflection to increment the currentPeriodsCounter.
If a boolean option (e.g. "newFileOnStart") was added to SizeAndTimeBasedFNATP and computeCurrentPeriodsHighestCounterValue was modified to return whether or not a matching file was found, then the start method could be modified as shown below:
if (tbrp.getParentsRawFileProperty() == null) {
String regex = tbrp.fileNamePattern.toRegex(dateInCurrentPeriod);
String stemRegex = FileFilterUtil.afterLastSlash(regex);
// beginning of changes
boolean fileExists = computeCurrentPeriodsHighestCounterValue(stemRegex);
if (fileExists && newFileOnStart) {
currentPeriodsCounter++;
}
// end of changes
}
|
Show » |
| There are no comments yet on this issue.
|
|