[logback-dev] [JIRA] Created: (LBCORE-145) option to create new file on start of SizeAndTimeBasedFNATP
Ryan Cogswell (JIRA)
noreply-jira at qos.ch
Sat Mar 20 00:14:16 CET 2010
option to create new file on start of SizeAndTimeBasedFNATP
-----------------------------------------------------------
Key: LBCORE-145
URL: http://jira.qos.ch/browse/LBCORE-145
Project: logback-core
Issue Type: Improvement
Components: Appender
Affects Versions: 0.9.18
Reporter: Ryan Cogswell
Assignee: Logback dev list
Priority: Minor
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
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the logback-dev
mailing list