#1 2016-07-12 06:02:28

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

[not-an-bug] Zero-length log files?

Did anybody notice the recent version of mORMot generates log files that's empty?

I'm not sure since when (maybe about several weeks ago), but this problem wasn't existed since I use mORMot for years smile

Last edited by edwinsn (2018-04-24 07:54:22)


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

Offline

#2 2016-07-12 06:20:32

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

Re: [not-an-bug] Zero-length log files?

???
What do you call "empty"?
Did never see that, even with latest version of the framework.
There may be something wrong with your code.

Or perhaps the log is seen as "0 bytes" in the File Explorer, but in fact the data is there, and Windows will show the file size only when it is accessed.
In this case, this is a Windows unexpected behavior, which is a "feature", not a "bug", since we are dealing with Windows here. wink

Offline

#3 2016-07-12 07:31:54

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

Re: [not-an-bug] Zero-length log files?

Hello ab,

Actually, there are two kinds of empty files:

  - Log files whose length is 0 byte, and I checked it with a text editor, they are really empty.
  - Log files only has some header info, without any log entry, the following is copied from a real-life log file:

C:\_Data\DelphiDev\app1\App\Bin\app1_Server.exe 0.9.8.932 (2016-07-12 13:59:05)
Host=EDWIN-Notepad User=edwin CPU=4*9-6-15620:FFFBEBBFBFFBFA7D OS=11.1=6.1.7601 Wow64=1 Freq=2143496
Environment variables=
TSynLog 1.18.2774 FTS3 2016-07-12T14:49:47

And my code for setting up the logging:

procedure TServerMgr.SetupServerLogging;
begin
  TSynLog.Family.Level := LOG_VERBOSE;

  TSynLog.Family.AutoFlushTimeOut := 10;
  TSynLog.Family.OnArchive := EventArchiveZip;
  TSynLog.Family.ArchiveAfterDays := 7;
  TSynLog.Family.NoEnvironmentVariable := True;
  TSynLog.Family.LocalTimeStamp := True;

  TSynLog.Family.DestinationPath := GetServerLogsFolder;
  ForceDirectories(TSynLog.Family.DestinationPath);
end;

Any findings smile


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

Offline

#4 2016-07-12 08:48:58

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

Re: [not-an-bug] Zero-length log files?

Because you are using the TSynLog class and this is not the class in which the frameworks send its log.
Use the class stored in the global SQLite3Log variable.

Offline

#5 2016-07-12 10:06:14

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

Re: [not-an-bug] Zero-length log files?

Oh! I was so wrong! Thanks ab, corrected my program and I'll see what happens smile


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