#1 mORMot 2 » aLog in agl » 2025-12-14 09:37:46

dcoun
Replies: 2

hi,
in mormot.app.agl in constructor TSynAngelize.Create the aLog parameter is not used somewhere. Or I miss something?

#5 Re: mORMot 2 » ENetSock exceptions with THttpClientSocket.SockInReadLn Closed » 2025-11-25 14:56:34

I have the last update from github before 2 hours and I just had:

Exception: 20251125 14551607  - EXC   ENetSock {LastError:"nrClosed",Message:"THttpClientSocket.SockInReadLn [#5 Closed]"} [pool8-TepresSlave] at 9485d5 mormot.net.sock.pas TCrtSocket.DoRaise (5765)   mormot.net.client.pas THttpClientSocket.RequestInternal (3352) mormot.core.base.pas FastSetString (5160) mormot.net.client.pas THttpClientSocket.Request (3470) ephttp.pas Tephttp.httpGet (547) System.pas @ReallocMem (5093) ephttp.pas Tephttp.dohttp (669) ephttp.pas Tephttp.dohttp (689) slave.terminology.pas TTerminologySlave.GetTermCodesysEntities (169) slave.terminology.pas TTerminologySlave.Time2Run (95) rest.services.pas TepresSlavePool.Task (291) mormot.core.log.pas _SetThreadName (5429) mormot.core.log.pas _SetThreadName (5429) mormot.core.threads.pas TSynThreadPoolWorkThread.DoTask (3898) mormot.core.threads.pas TSynThreadPoolWorkThread.Execute (3930)  {12 65535.28 0.42 13 18.2GB/31.6GB 65f41b01}

#6 mORMot 2 » ENetSock exceptions with THttpClientSocket.SockInReadLn Closed » 2025-11-25 14:15:48

dcoun
Replies: 8

I am getting errors like the following when a THttpClientSocket has probably lost its connection due to timeout, because THttpClientSocket instance was not in use for a period of time.
It does not seem to cause any harm, but is it possible to check the state before the request in order not to have this exception?

Exception: 20251125 11271351  * EXC   ENetSock {LastError:"nrClosed",Message:"THttpClientSocket.SockInReadLn [#5 Closed]"} [pool6-TepresSlave] at ee8535 mormot.net.sock.pas TCrtSocket.DoRaise (5765)   mormot.net.client.pas THttpClientSocket.RequestInternal (3310) mormot.core.text.pas VarRecToTempUtf8 (9375) mormot.net.ws.core.pas FrameInit (1486) mormot.core.buffers.pas AppendRawUtf8ToBuffer (9535) mormot.core.base.pas AppendShort (5376) mormot.core.base.pas FastSetString (5160) mormot.net.client.pas THttpClientSocket.Request (3428) System.pas @GetMem (4971) mormot.core.base.pas FastSetString (5160) System.pas @GetMem (4971) mormot.core.buffers.pas FromVarString (3497) System.pas @FreeMem (5019) System.pas @LStrClr (26350) System.pas @FinalizeRecord (33306) ephttp.pas Tephttp.httpGet (547) System.pas @ReallocMem (5093) ephttp.pas Tephttp.dohttp (669) ephttp.pas Tephttp.dohttp (689) slave.terminology.pas TTerminologySlave.GetTermCodesysEntities (169) slave.terminology.pas TTerminologySlave.Time2Run (95) rest.services.pas TepresSlavePool.Task (291) mormot.core.log.pas _SetThreadName (5429) mormot.core.log.pas _SetThreadName (5429) mormot.core.threads.pas TSynThreadPoolWorkThread.DoTask (3898) mormot.core.threads.pas TSynThreadPoolWorkThread.Execute (3930)  {6 4.26 2.92 5.3GB/7.7GB 66581b01}

Delphi 12.3 win64

#8 Re: mORMot 2 » many many same errors from tsynlog » 2025-11-17 18:31:03

I am getting all other errors with line numbers, that is the reason I am sure that map file is used.
The problem is that this happens to computers I do not have access to test, but I have enabled debug info for other reason.
It doesn't happen to my debug environment.
I will try tomorrow to see if the windows user account type (if it is a limited user) can be the reason.
But is it possible somehow to get the dll that causes it?

#9 mORMot 2 » many many same errors from tsynlog » 2025-11-17 14:29:41

dcoun
Replies: 5

I am getting a big number of errors from tsynlog in my program like the following:

Exception OS: 20251117 10025441  ! EXCOS EExternalException (1073807370) [Main] at 7ffa5761804a  {8 4.64 6.21 10 4.9GB/7.7GB 8.2GB/9.7GB 65f41b01}
Exception OS: 20251117 10025441  ! EXCOS EExternalException (1073807366) [Main] at 7ffa5761804a  {8 4.64 6.21 10 4.9GB/7.7GB 8.2GB/9.7GB 65f41b01}
Exception OS: 20251117 10025441  ! EXCOS EExternalException (1073807370) [Main] at 7ffa5761804a  {8 4.64 6.21 10 4.9GB/7.7GB 8.2GB/9.7GB 65f41b01}
Exception OS: 20251117 10025441  ! EXCOS EExternalException (1073807366) [Main] at 7ffa5761804a  {8 4.64 6.21 10 4.9GB/7.7GB 8.2GB/9.7GB 65f41b01}
Exception OS: 20251117 10025441  ! EXCOS EExternalException (1073807370) [Main] at 7ffa5761804a  {8 4.64 6.21 10 4.9GB/7.7GB 8.2GB/9.7GB 65f41b01}
Exception OS: 20251117 10025441  ! EXCOS EExternalException (1073807370) [Main] at 7ffa5761804a  {8 4.64 6.21 10 4.9GB/7.7GB 8.2GB/9.7GB 65f41b01}
Exception OS: 20251117 10025441  ! EXCOS EExternalException (1073807366) [Main] at 7ffa5761804a  {8 4.64 6.21 10 4.9GB/7.7GB 8.2GB/9.7GB 65f41b01}


They can be more than 100 with the same timestamp and there is no apparently problem when using my app.
I am not sure if webview2, the edge dll, cause them or an other dll like mariadb's dll. It does not return me any line number and I am not sure about the numbers in GB I see at the end.
Is there a way to get more information from tsynlog? Or can it be a problem from tsynlog that causes the same message to be archived multiple times?
Delphi 12.3 /windows / 64Bit compiled
Thank you in advance

#10 Re: mORMot 2 » variable that is nil is used and cause exception » 2025-11-06 15:58:15

ab wrote:

I still don't understand how you defined the IList instance.

TormGetbundle=class(Torm)
    private
      Fdedo: RawUtf8;   Fupddat: tdatetime;    Ftyp,Fekdosi: integer;
    public
      class procedure InitializeTable(const Server: IRestOrmServer; const FieldName: RawUtf8; Options: TOrmInitializeTableOptions); override;
    published
      property typ:integer read Ftyp write Ftyp;           
      property ekdosi:integer read Fekdosi write Fekdosi;
      property dedo:RawUtf8 read Fdedo write Fdedo;     
      property upddat:tdatetime read Fupddat write Fupddat;
  end;

The errors happens when I do the following:
lis:=collections.NewList<TormGetbundle>;

TormGetbundle in this windows app is not an db table, (part of shared code with an other app that uses it as db table)

#11 Re: mORMot 2 » variable that is nil is used and cause exception » 2025-11-05 09:52:25

ab wrote:

I still don't understand how you defined the IList instance.

I was using NewPlainList instead of NewList, as I notice now.
But still, in the above code if fDynArray.Info.ArrayRtti = nil, then the fDynArray.Info.ArrayRtti.Kind in EIList.RaiseUtf8 will give exception

#12 Re: mORMot 2 » variable that is nil is used and cause exception » 2025-11-05 09:19:29

Apologies Ab, I did not define anything new
I noticed that this happens since the updates in github after 3/11/25
The exception I get is in EIList.RaiseUtf8 and when debugging the fDynArray.Info.ArrayRtti is nil

#13 Re: mORMot 2 » variable that is nil is used and cause exception » 2025-11-04 21:56:59

@ab, Delphi 11.3 in a Torm class
but:
if (fDynArray.Info.ArrayRtti = nil) or
     (fDynArray.Info.ArrayRtti.Kind <> aItemTypeInfo^.Kind)  then
    EIList.RaiseUtf8('%.Create<%> (%) does not match % (%)',
      [self, aItemTypeInfo^.RawName, ToText(aItemTypeInfo^.Kind)^,
       aDynArray.Info^.RawName, ToText(fDynArray.Info.ArrayRtti.Kind)^]);

#14 mORMot 2 » variable that is nil is used and cause exception » 2025-11-04 11:41:22

dcoun
Replies: 7

mormot.core.collections, line 902

if fDynArray.Info.ArrayRtti is nil then fDynArray.Info.ArrayRtti.Kind will cause exception
I have random errors from that

constructor TIListParent.CreateRtti(aDynArray: TRttiCustom;
  aItemTypeInfo: PRttiInfo; aOptions: TListOptions; aSortAs: TRttiParserType);
begin
  fDynArray.InitRtti(aDynArray, fValue, @fCount);
  aSortAs := fDynArray.SetParserType(aSortAs, // aSortAs=ptNone->RTTI
    loCaseInsensitive in fOptions);
  if (fDynArray.Info.ArrayRtti = nil) or
     (fDynArray.Info.ArrayRtti.Kind <> aItemTypeInfo^.Kind)  then
    EIList.RaiseUtf8('%.Create<%> (%) does not match % (%)',
      [self, aItemTypeInfo^.RawName, ToText(aItemTypeInfo^.Kind)^,
       aDynArray.Info^.RawName, ToText(fDynArray.Info.ArrayRtti.Kind)^]);

#15 Re: mORMot 2 » adding a Torm in a mysql table does not return an error as it should » 2025-11-01 14:43:28

ab wrote:

The ORM has no way of actually knowing the range in the database.
At the ORM level, it handles 64-bit signed integers.

It is up to the user code to ensure the value is in the correct range.

I agree, my question was about the error that was not reported.
The response from Trestbatch.send was 200

#16 mORMot 2 » adding a Torm in a mysql table does not return an error as it should » 2025-10-31 12:19:24

dcoun
Replies: 2

Today,  I noticed that when adding a new Tormmyorm in an external mysql database, the record was not added in the database table.
The result from add was Ok, with the ID number, no exception somewhere
Trying to debug it, I found from ZEOS log that one field of the Tormmyorm had a value that was bigger that the allowed range in the database.
Zeos returned that no record was added and an error like the following:
'2025-10-31 14:08:44.386' cat: Execute, proto: mariadb, msg: Statement 903 : insert into myorm (ID,xxxx,xxxx,labo,xxxx) values (?,?,?,?,?,?,?,?,?,?,?,?), errcode: 1264, error: Out of range value for column 'labo' at row 1
I know that the table's field were changed to a smaller integer type and that was not caught in orm's object, but should I expect an error in such a case from mormot?
Thank you in advance

#17 Re: mORMot 2 » ParseTimeZone and ISO8601 » 2025-10-22 18:34:53

@ab,  I full agree with you.
The mormot is a great framework and it can be used futher than just a rest framework
I come I across with a date coming from a project and I spend little time to see what happens. I just left this topic as a FYI
Thank you again for this great work

#18 mORMot 2 » ParseTimeZone and ISO8601 » 2025-10-22 10:28:50

dcoun
Replies: 2

Trying to parse string datetime values in ISO 8601 I noticed that:
- In values like 2025-10-21T21:43:08-12:00  the timezone is not parsed
- When I provide only the "-12:00" part in ParseTimeZone it returns false
- ParseTimeZone works and returns true with values like "-1200" which is not the standard ISO 8601

just for your info

#19 Re: mORMot 2 » ESChannel exception » 2025-10-13 11:19:04

Windows 8.1 (which could a good reason for this problem)
It does not return a Server header and it is not available everywhere outside Greece to test its options with an online tool

#20 mORMot 2 » ESChannel exception » 2025-10-13 09:57:33

dcoun
Replies: 4

using THttpClientSocket to connect to server in the internet, in a number of clients I getting an exception after running the THttpClientSocket.OpenOptions:

THttpClientSocket.DoTlsAfter: TLS Failed [ESChannel <the host name>: HandshakeStep returned 80090326 SEC_E_ILLEGAL_MESSAGE, System Error 87 [ERROR_INVALID_PARAMETER]]

Do you propose something? (I have tested TLS.IgnoreCertificateErrors:=true and I am testing now TLS.ClientAllowUnsafeRenegotation:=true)
Thank you in advance

#21 Re: mORMot 2 » Delphi compilation errors » 2025-10-06 13:56:09

In mormot.db.sql.zeos, fForceDateWithMS is not found in line 1428

#22 mORMot 2 » runcommand returns -1 even in successful start » 2025-09-17 07:49:29

dcoun
Replies: 2

Hi,
With the last updates the following returns -1 where in the past the result was 0.

res:=RunCommand(apppath+'test.exe',false);

The test.exe is started ok even with the -1 result

#23 Re: mORMot 2 » Mormot2 http client does not return content if stream is used » 2025-08-21 13:43:56

ab wrote:

THttpClientSocket does not support chunked answers, only servers returning a proper content-length header.

Anything changed about "chunked answers"?

#24 Re: mORMot 2 » ExceptionMessage="TSynDictionary.Add fValues.Add" » 2025-08-13 15:55:36

You have right, it is from previous entries when it was not an array and saved as a record

#25 mORMot 2 » ExceptionMessage="TSynDictionary.Add fValues.Add" » 2025-08-13 14:01:02

dcoun
Replies: 2
type
  Danaforavalue=packed record o:integer; end;
  Aanaforavalues=Tarray<Danaforavalue>;

procedure TForm3.Button1Click(Sender: TObject);
var
  i:integer;
  defnormals:ikeyvalue<integer,Aanaforavalues>;
  defmondefn:Aanaforavalues;
begin defnormals:=collections.NewPlainKeyValue<integer,Aanaforavalues>;
defnormals.Data.LoadFromJson('{"258":{"o":4}}');
setlength(defmondefn,2);
i:=1;
defnormals.tryadd(i,defmondefn);
end;

Last line, tryadd, gives exception. Why?

#26 Re: mORMot 2 » creating index through mormot's orm with part of field's content » 2025-05-05 17:25:55

It is ok, @ab.
Thank you a lot for the amazing mormot2.

#27 Re: mORMot 2 » creating index through mormot's orm with part of field's content » 2025-05-05 14:58:56

My stack during the error:
- r77204424 KERNELBASE RaiseException + 0x64 
- mormot.core.text.ESynException.RaiseUtf8('%:IndexByNameOrExcept(%):unknown field in %', (...)) 
- mormot.orm.base.TOrmPropInfoList.IndexByNameOrExcept('nam(30')) 
- mormot.orm.core.TOrmMapping.InternalToExternalDynArray(???, ('del', 'cat', "), $IEDOF870) 
- mormot.orm.sql.TRestStorageExternal.CreateSqlMultifindex(???, (...).False, 'NDXExNams_del_cat_nam') 
- mormot.orm.server.TRestOrmServer.CreateSqlMultifindex(TOrmExNams, (...).False, 'NDXExNams_del_cat_nam') 

I found out that defining nam(30) as field in CreateSqlMultiIndex does not work.
The question is if is going to be supported or not.
I have no problem to create manually such indexes if mormot can not support them.

#29 mORMot 2 » creating index through mormot's orm with part of field's content » 2025-05-05 14:12:40

dcoun
Replies: 6

I have an Torm object and I am MariaDB as external database
When Torm.InitializeTable runs for this table, it checks and create the index if it does not exist.

The SQL that should be run for mysql is: CREATE INDEX IF NOT EXISTS NDXExNams_del_cat_nam ON exnams(del,cat,nam(30));

This can not be done through Mormot and I am getting the error: "TOrmPropInfoList.IndexByNameOrExcept(nam(30)): unkwnown field in TOrmExNams"

The db field nam is about 2048 bytes and it is not allowed to have all content in the index. With the above sql only the first 30 characters are used in the index.

The same query in Postgresql can be: CREATE INDEX IF NOT EXISTS "NDXExNams_del_cat_nam" ON exnams(del, cat, substring(nam, 1, 30));

Is it possible to bypass the check for the field names from mormot or give up and create them manually?

Thank you in advance

#30 Re: mORMot 2 » a scenario about adding a record with unique field... » 2025-03-23 17:46:34

Zeos with mariadb
postgresql with mormot's direct

#31 Re: mORMot 2 » a scenario about adding a record with unique field... » 2025-03-23 17:34:34

In an other thread, you propose to recreate the database connection. How can I do that?
I notice that I can "expire" the connections pool. What should I check before doing that?

#32 Re: mORMot 2 » a scenario about adding a record with unique field... » 2025-03-23 17:09:57

The in-memory dictionary can not be used if I have an other app outside mormot that feeds too records.
I can use the in-memory dictionary for a number of tables, but not for all.

#33 Re: mORMot 2 » a scenario about adding a record with unique field... » 2025-03-23 16:28:34

The problem with the TrestBatch, is that sometimes the next orm object needs first object's IDvalue in one of its properties.
How can I handle this?

#34 Re: mORMot 2 » a scenario about adding a record with unique field... » 2025-03-23 11:18:41

ab wrote:

So why not just this PtrInt field as the TID?

Because in the near future, the unique field can be a string too. In an other table, it is a GUID

#35 Re: mORMot 2 » a scenario about adding a record with unique field... » 2025-03-23 11:07:51

ab wrote:

Some comments:
1) don't use PtrInt for a field, it is not portable between 32-bit and 64-bit. Use explicit Int64 or integer.
2) what do you store into this field? Why just not use the TID?
3) look at TSynUniqueIdentifier if you really need a separated field, or at TOrmModel.SetIDGenerator() to have the ORM fill the TID directly.

The unique field TormTable.unif's content is predefined by other source. I can not change it. But I must have one record in the table per TormTable.unif content.
I thought about hash32 for defining idvalue but I want to avoid it, because in other tables I have multiple unique fields and it becomes more possible for duplicate hash result

#36 mORMot 2 » a scenario about adding a record with unique field... » 2025-03-23 09:53:16

dcoun
Replies: 12

Probably a scenario for a newbie but I am not still sure how to implemented correctly with mormot2:
Everything from the following is happening in the server which connects to an external database and I am using AcquireExecutionMode[execOrmWrite/Get]:=amBackgroundThread;
I have a table TormTable, that except the table ID, it has also an other unique field unif, covered with a unique database index.

TormTable=class(Torm)
  published 
    property unif:ptrint read Funif write Funif;
end;

Before I add a new record in this table (as one job in a list of sql orm adds), I check if an existing record has the same content with the field TormTable.unif and use this record instead.
My problem is to add a new record in this table in a race condition:
Checking if a record with the same TormTable.unif exists and using a TRestBatch for all adds in my function is a solution.
But it can cause a error is a record with the same TormTable.unif contents was just inserted by an other web client request. (There is also a small possibility that such a record can be added by an other external software in the db-This table is defined to check maxID before each insert in mormot).
I was thinking that I can repeat the check and the Trestbatch. But sometimes I am getting out of sync errors from Zeos with indexes collisions and I have not find a solution to avoid them.
In such a case, what is the appropriate way to close and recreate the connection or refresh the db connection pool, in a running mormot server?

An other solution is to use db transaction locking for this table.
1. In such a case, should I use AcquireExecution[execOrmWrite].Safe^.Lock; before Begintransaction?
2. calling commit, if I get an exception should I issue a rollback?
Generally which is the safe way to handle a transaction?

Thank you in advance

#38 Re: mORMot 2 » Torm.GetJsonValues has problem with greek characters » 2025-03-20 07:59:39

I noticed that EnsureRawUtf8 fixes it. I will use it, not to cause trouble.

#39 mORMot 2 » Torm.GetJsonValues has problem with greek characters » 2025-03-19 21:19:48

dcoun
Replies: 3

Today I update the mormot source for a project and I noticed that there is a character issue starting probably with commit 8338979 or one in the following 4-5 commits.

With the last changes I am getting the greek characters in form like Αιτιολόγιση για μη

The problem I noticed first has to do with Torm.GetJsonValues. Check the following source:
  TOrmSoup=class(Torm)
  private
    Fplanttwo: rawutf8;
    Fplantone: rawutf8;
    published
      property plantone:rawutf8 read Fplantone write Fplantone;
      property planttwo:rawutf8 read Fplanttwo write Fplanttwo;
  end;

procedure TForm3.Button1Click(Sender: TObject);
var o:tormsoup; s:rawutf8;
begin
o:=tormsoup.Create;
o.plantone:='Κρεμμύδι';
o.planttwo:='πατάτα';
s:=o.GetJsonValues(true,true,ALL_FIELDS);
end;

The result in s is now:
s='{"RowID":0,"plantone":"Ξ'#$9A'Ο'#$81'ΞµΞΌΞΌΟ'#$8D'δι","planttwo":"πατάτα"}'

Using JsontoObject instead of GetJsonValues does not produce this problem.

The reason I am using GetJsonValues (and not JsontoObject) is to have the possibility to select which fields I need to be exported to Json string.

#40 Re: mORMot 2 » Delphi compilation errors » 2025-03-19 20:25:08

ab wrote:

On which compiler?

Can you describe the problem?
Can you state the error message displayed?

I can't reproduce the problem here.
I tried with Delphi up to 12.2 with no compiler complain when building the mORMot2Tests project.


Delphi 12.2 and try the following:
procedure TForm3.Button1Click(Sender: TObject);
var a,b,c:array of integer;
begin
setlength(a,2);
setlength(b,3);
c:=concat(a,b);
end;

if mormot.core.base is uses list, it does not compile.
I had to change all to: c:=system.concat(a,b);

#41 Re: mORMot 2 » Delphi compilation errors » 2025-03-19 15:19:02

RTL concat for arrays has compilation problems with mormot's concat in mormot.core.base

#42 Re: mORMot 2 » Mormot2 LogView » 2025-03-18 12:33:46

Compile it with mormo1 and use it in mormot2

#44 Re: mORMot 2 » stop ikeyvalue from managing value's memory » 2025-03-02 16:25:30

@ab really thank you....
From a small request, you did a lot of work during the weekend

#45 Re: mORMot 2 » stop ikeyvalue from managing value's memory » 2025-03-01 09:54:52

Really thank you a lot!!!

But Values is read property that can not be assigned

#46 mORMot 2 » stop ikeyvalue from managing value's memory » 2025-03-01 09:40:44

dcoun
Replies: 4

I have a idmaper:Ikeyvalue<Ptrint,Ttreenode> to store Ttreenodes that are already managed for their memory in a Ttreeview.
How can I stop Ikeyvalue from freeing the Ttreenode for this specific idmaper:Ikeyvalue<Ptrint,Ttreenode> instance
trying to change idmaper.Data.Values.Info.info after creating idmaper does not work. And there is no option loNoFinalize as with Ilists
Thank you in advance

#47 Re: mORMot 2 » logging with agl-angelize » 2025-02-12 12:09:02

Finally with expandfilename I found that c:\windows\system32 is used as root path for services
For the logs, that where the initial problem, the log path provided was not relative, so it should not be caused by the path environment of the windows service. Anyway, I learn a lot for the services from this problem.
I found no solution for the log  with Tsynlog.
Finally I used the EchoCustom and nofile=true and all logs are saved now ok in a file with a separate function.

#48 Re: mORMot 2 » logging with agl-angelize » 2025-02-12 10:28:20

Thank you for the response. My initial though was about that file permissions can produce the problem even with LocalSystem which is similar to administrator account.
But other files are created when running as a service in the same/different directories, the file permissions include account SYSTEM with full access. Even a mormot's function IsDirectoryWritable("directory",[idwTryWinExeFile,idwWriteSomeContent]);  returns true.
My delay in response today, is because I found something interesting:
A mormot function like filefromstring('write this for testing',myfile) does not always produce a file when it runs from a service inside a directory named "c\work":
if myfile is 'c:\work\test\test.txt' the file is produced
if myfile  is 'test\test.txt' the file is NOT produced, but it returns TRUE

all other functions for 'test\' like directoryexisting, etc, return true, and let you believe everything is ok
I believe windows write somewhere else the files but I can not find the path, c:\windows\system32, c:\windows\syswow64, and other I tested do not include the files

I did not also find a function to check this kind of path and reform it, in order to avoid such a problem

#49 Re: mORMot 2 » logging with agl-angelize » 2025-02-12 06:39:34

the same executable (tsynAngelize derived class object), when it runs as a windows services it does NOT log anything after service started. The same executable when it is started with -c parameter, it logs everything ok with Tsynlog
the service runs as LocalSystem "account".
it is created as

inherited create(tmyAngelconfig, nil, etcdirnam, config.workdir.ToString,  settingspath+'services', config.LogPath, '.conf', 'agl', [fsoDisableSaveIfNeeded]);
with fsas.LogClass.Family do begin 
NoFile:=false; 
fsas.Log:=[sllWarning, sllError,sllLastError,sllMemory, sllFail, sllException, sllExceptionOS ];
RotateFileDailyAtHour:=0; 
RotateFileCount:=10; 
AutoFlushTimeOut:=3; 
end;
WebSocketLog:=fsas.LogClass; 
fsas.LogRotateFileCount:=10; 

I expect the same executable to log the same either started as a windows service either as a console application.

#50 Re: mORMot 2 » logging with agl-angelize » 2025-02-09 13:07:38

dcoun wrote:

Running as a service does not write any log entries to the file. Are they redirected somewhere else?

I have a windows service based on angel project and Tsynagelize
With the following code, after the windows service starts, I have no log entries in the log during the time that the services runs. Tested for hours.

function log2file(const s: rawutf8; const Args: array of const; const deb:boolean=false):boolean; 
begin 
  result:=true; 
  if not deb then exit;
  tsynlog.DoLog(sllCustom4,s,args); end;

With the following function, without any other change in code/configuration, I have log entries from this functions that they have the format of Tsynlog (the appendtofile returns false), even during the windows service runs, after starting/before stopping

function log2file(const s: rawutf8; const Args: array of const; const deb:boolean=false):boolean; 
begin 
  result:=true; 
  if not deb then exit;
  if not AppendToFile(formatutf8(s+#13,args),'agl.log') then tsynlog.DoLog(sllCustom4,s,args); 
end;

In both cases the Tsynlog has to send the log entries to agl.log file.

Board footer

Powered by FluxBB