#1 2013-02-06 11:27:32

VojkoCendak
Member
From: Celje Slovenia
Registered: 2012-09-02
Posts: 88

Logging enhacement

Hi, Delphi2009ent

1. Is it possible to set maximum file size and maximum rotating files (if any) ?
I had a problem that log file got over 80G :rolleyes.
We need that logging be able to limit itself:
a. maximum logfile size
b. possible to have rotating logfiles ?

2. It would be nice to have possibility to have same logfilename without time.

3. We want to add console in GUI application but we saw the StdOut in initialized in initialisation section.
We create Console woth AlloCConsole and FreeConsole.
For Now we just put RetrieveSystemInfo in Interface for now.

4. (newest version): we have problem with Logview viewing files when debugged (all lines are white). In Run mode works ok.

5. some kind of general function that would run LogView with latest logfile ? that would be nice


thank you,
Vojko Cendak

Last edited by VojkoCendak (2013-02-06 12:21:09)

Offline

#2 2013-02-06 16:43:47

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

Re: Logging enhacement

Very good ideas.

Could you create some tickets, as Feature Requests, in http://synopse.info/fossil/reportlist ?
(you just need to log to fossil as anonymous)

Offline

#3 2013-02-21 07:35:18

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

Re: Logging enhacement

I've created the ticket.

Add optional log file rotation of several logs (with optional compression/deletion of older files) to the TSynLog family properties.
The log file name may therefore be fixed, and new explicit "start/stop application" events shall be added, to quickly go

By design, only one process would attempt to the same set of rotated files.
And all threads shall be logged within the same log file (no one file per thread feature in rotate mode).

TSynLogFamily may threfore be changed to use an enumeration instead of some boolean properties.

Files may be prepared, i.e. filled with spaces, to enhance writing speed (nice to have - only if worth it).

See http://synopse.info/fossil/info/72feb66d45

Offline

#4 2013-03-12 12:25:43

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

Re: Logging enhacement

TextColor() and TextBackground() will now initialize internal console process after any manual AllocConsole call
See http://synopse.info/fossil/info/b0f13e36a1

So you can just write:

  // manual switch to console mode
  AllocConsole;
  TextColor(ccLightGray);

See also the new procedure ConsoleWaitForEnterKey.

Offline

#5 2013-03-25 19:43:00

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

Re: Logging enhacement

We have introduced TSynLogFamily.RotateFileCount and RotateFileSizeKB properties, to enable log file rotation and SynLZ compression.

Log file rotation is as easy as:

  with TSQLLog.Family do begin
    Level := LOG_VERBOSE;
    RotateFileCount := 5; 
    RotateFileSizeKB := 20*1024; // rotate by 20 MB logs
  end;

Note that in this case, PerThreadLog and HighResolutionTimeStamp properties will be ignored, since both features expect a single process to run.

See http://synopse.info/fossil/info/c26f17286d

And do not forget to re-compile the Log Viewer tool from the latest sources, or retrieve the today's compiled version (compiled with Delphi 2007) from http://synopse.info/files/LogView.zip

Offline

Board footer

Powered by FluxBB