You are not logged in.
Pages: 1
hey,
After Creating 2 services , the log get stuck.
c:\mik4win\Service.exe 1.0.0.0 (2020-06-24 14:00:56)
.. some computer data here...
TSynLog 1.18.5369 2020-06-28T10:26:49
and it hangs there.
the process is not login
the log is defined as such:
var
Log: TSynLog;
function InitLogger :TSynLog ;
begin
with TSynLog.Family do begin
Level := LOG_VERBOSE;
Level := [sllInfo,sllException,sllExceptionOS];
PerThreadLog := ptOneFilePerThread;
OnArchive := EventArchiveSynLZ;
ArchiveAfterDays := 3; // archive after one day
RotateFileCount := 7; // will maintain a set of up to 5 files
RotateFileSizeKB := 1024; // rotate by 1 MB logs
DestinationPath := 'c:\folder\';
end;
Result := TSynLogClass.Create(TSynLog.Family);
end;
using version 1.18
any idea why?
anyone tried testing the logger with services?
Last edited by vjpbiuh (2020-06-28 11:09:22)
Offline
We use TSynLog on services on production since years, with PB of logs correctly generated, sometimes with dozen of services on the same instances.
You are using TSynLog directly, which is NOT the correct way.
You should use the class, not a custom TSynLog instance.
The TSynLog instance should be allocated by the class methods, like TSynLog.Add or TSynLog.Enter.
I understand it may sound disturbing, but it is the way found to efficiently use a per-thread log if needed.
Offline
Thank you very much for your response. I have changed the code to use the metaclass. where is the best place to set the values of the meta class TSynLog?
1. dpr after the begin?
2. initialization on the thread class?
3. initialization on the service class?
4. on the on start even of the service?
5. on the execute of the thread?
Offline
6. When you expect to start loging.
which is probably as soon as possible - possibly in the dpr, or when the settings have been read from disk.
There is a settings class in mORMotService.pas which allows custom logging, for instance.
Offline
Pages: 1