History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LBCORE-145
Type: Improvement Improvement
Status: Open Open
Priority: Minor Minor
Assignee: Logback dev list
Reporter: Ryan Cogswell
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
logback-core

option to create new file on start of SizeAndTimeBasedFNATP

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


 Description  « Hide
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
    }


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.