#1 2021-01-19 17:54:06

tbo
Member
Registered: 2015-04-20
Posts: 335

class TSynDaemon and the LogPath variable

On Linux, the LogPath variable cannot be set in the constructor of the TSynDaemon class. The LogPath variable is initialized in the TSynDaemonSettings class and thus the aLogFolder parameter is not considered. This makes the behavior different between Windows and Linux compilation.

constructor TSynDaemonSettings.Create;
begin
...
  {$ifndef MSWINDOWS}
  fLogPath := GetSystemPath(spLog); // /var/log or $home
  {$endif MSWINDOWS}
end;  

constructor TSynDaemon.Create(aSettingsClass: TSynDaemonSettingsClass;
  const aWorkFolder, aSettingsFolder, aLogFolder, aSettingsExt, aSettingsName: TFileName);
var
  fn: TFileName;
begin
...
  if fSettings.LogPath = '' then
    if aLogFolder = '' then
      fSettings.LogPath := {$ifdef MSWINDOWS}fWorkFolderName{$else}GetSystemPath(spLog){$endif}
    else
      fSettings.LogPath := EnsureDirectoryExists(aLogFolder);
end;

With best regards
Thomas

Offline

Board footer

Powered by FluxBB