-
Notifications
You must be signed in to change notification settings - Fork 92
Closed
Labels
acceptedIssue has been accepted and inserted in a future milestoneIssue has been accepted and inserted in a future milestonebug
Milestone
Description
#54 triggered my memory. During testing loggerpro, I came across the following problem: If you set the log rotation to zero, like
in LoggerPro.Config in the file appender example
_Log := BuildLogWriter([
TLoggerProFileAppender.Create(0, 5, '..\..', [],
TLoggerProFileAppender.DEFAULT_FILENAME_FORMAT, DEFAULT_LOG_FORMAT)
...
an EFileNotFoundException
is raised in procedure TLoggerProFileAppenderBase.RetryMove
.
The simplest solution for me would be to either assert that the value is at least one or set it to Min(1, ...) in the constructor. I consider no rotation an invalid use case :)
So either:
constructor TLoggerProFileAppenderBase.Create(...
begin
Assert(aMaxBackupFileCount > 0, 'Log rotation must be at least one.');
...
or
constructor TLoggerProFileAppenderBase.Create(...
begin
...
fMaxBackupFileCount:= Min(1, aMaxBackupFileCount)
...
Metadata
Metadata
Assignees
Labels
acceptedIssue has been accepted and inserted in a future milestoneIssue has been accepted and inserted in a future milestonebug