Closed pjrobin closed 1 year ago
Seems to be a problem in GetLogFileBackup: is is searching for 'C:\Users\Public\Documents\Logs\myapp.01.*.log.zip'
This could be the fix:
function TLogFileProvider.GetLogFileBackup(cNumBackup: Integer; zipped: Boolean): string;
var
SearchRec: TSearchRec;
i: Integer;
begin
// Doing this twice to be backward compatible independent if the numbackup is formatted or not
for i := 0 to 1 do
begin
if DailyRotate then
Result := CalcRotateLogFileName (cNumBackup, '*', zipped, i = 0)
else
Result := CalcRotateLogFileName (cNumBackup, '', zipped, i = 0);
if findfirst (Result, faAnyFile, SearchRec) = 0 then
Result := TPath.GetDirectoryName (Result) + PathDelim + SearchRec.Name
else
Result := '';
FindClose (SearchRec);
if Result <> '' then
Exit;
end;
end;
I think something is brocken in the Pull request #91: Before the pull:
in my log folder, i had myapp.log, myapp.1.log and so on
Now: I have myapp.log, myapp.01.log When I start the application and myapp.01.log already exists then the logfileprovider will produce an exception when trying to enable it in RotateLog: 'Can''t rotate log file: the file already exists '#$D#$A'[C:\Users\Public\Documents\Logs\myapp.01.log]'