#1 2016-06-27 10:53:46

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

[fixed] Is there a way to force new log file?

Hello Aranud,

I made a TSynLog derived class and customize the log options, like:

type
  TMyLog = class(TSynLog)
  end;
  ...

  // I setup the log options in the constructor of my object that uses this log class, like this:
  procedure TMyThread.Create;
  begin
    TMyLog.Family.CustomFileName := 'MyLogFile';
  end;
  ...

  // and I add logs like this:
  TMyLog.Add.Log(sllInfo, '...');
  ...  
  

With these setup, my log files look like: "MyLogFile 20160627 143255.log", which is OK, and my Question: is:

How to force it to create a new log file? Thanks.

Last edited by edwinsn (2016-06-27 11:43:06)


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#2 2016-06-27 11:01:00

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,667
Website

Re: [fixed] Is there a way to force new log file?

Did you try TSynLog.CloseLogFile method?

Offline

#3 2016-06-27 11:42:50

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: [fixed] Is there a way to force new log file?

Great! That did the trick!

I previously tried Release(), but didn't try this one :;


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

Board footer

Powered by FluxBB