#1 2013-02-20 15:30:25

Bascy
Member
From: The Netherlands
Registered: 2012-06-22
Posts: 108

Using TSQLVirtualtablelog with ORM

I'v defined a TSynLog in our server application, and would like to be able to retrieve the logged records from our client application using ORM and the TSQLRecordLogFile definition.

How can this be achieved?

Offline

#2 2013-02-20 17:55:17

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

Re: Using TSQLVirtualtablelog with ORM

This is a good idea.

But you would need to load the whole file periodically to refresh the content, since all data is appended directly to the text file, so the log content will not be updated.
In order to be updated, perhaps a TTextWriterEcho-like callback could be used, to avoid re-parsing the whole file - or just a "refresh" method for the TSynLogFile class.

Let us think about it, and find the best solution to implement it.

Perhaps worth a ticket for feature request?

Offline

#3 2013-02-20 18:04:08

Bascy
Member
From: The Netherlands
Registered: 2012-06-22
Posts: 108

Re: Using TSQLVirtualtablelog with ORM

Added the ticket

Offline

#4 2013-02-21 07:38:51

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

Re: Using TSQLVirtualtablelog with ORM

I've made a rough technical analysis of it.

This feature request could be implemented as such:
- Modify TSynLogFile to not retrieve the method profiling, if not mandatory;
- Publish TSQLRecordLogFile definition;
- Add fast binary search TSQLVirtualTableCursorLog for TSQLRecordLogFile.DateTime timestamp;
- Add a direct access to the "logging" virtual table if TSQLRecordLogFile is included within the current TSQLModel;
- Declare a new TSQLRecordLogFileProfiling to access the methods profiling data;
- Add a direct access to the profiling virtual table if TSQLRecordLogFileProfiling is included within the current TSQLModel;
- Auto-refresh the log file (at first, re-read whole content);
- Add a "refresh" method for the TSynLogFile class, without parsing the whole file content more than once - need also to modify TMemoryMapText class.
This feature request is certainly linked to log rotation proposal.

See http://synopse.info/fossil/info/07aacd3eea

Offline

#5 2013-03-25 22:54:34

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

Re: Using TSQLVirtualtablelog with ORM

... another potential analysis may be not to write into a text file, but a plain SQlite3 table (with a transaction to group records writing), or a custom binary format...

The possibility to make SQL requests over a log definitively does make sense to me, especially if the log content is huge.

Offline

Board footer

Powered by FluxBB