To content | To menu | To search

Search - tsynlog

2015, Thursday May 14

Using TSynLog with a lot of threads? PYou should better upgrade your source

We identified and fixed today several issues which may affect applications creating a lot of threads (i.e. not using a thread pool).
The symptom was an unexpected access violation, when you reach a multiple of 256 threads count.

You should better upgrade to at least revision 1.18.1351 if your application creates a lot of custom threads.
Note that a regular mORMot server, using http.sys and its thread pool won't be affected by this issue.

We also refactored the whole threading process in TSynLog, so that:

  • The thread numbers in the .log file would be re-used;
  • The memory resources associated with each thread would be released and re-used;
  • It would handle an infinite number of thread creation (previous implementation did have a hard limit of 32,768 created threads during a process lifetime);
  • Exception would never be intercepted during logging process;
  • Made code stronger, and re-entrant in case of concurrent TSynLog classes in the same process;
  • Of course, this works also under Linux, via FPC or (Cross)Kylix.

See our Source Code Repository TimeLine.

Feedback is welcome on our forum, as usual!

2013, Sunday February 3

Log to the console

Our framework features an integrated logging class, ready to be enabled for support and statistics.

For debugging purposes, it could be very handy to output the logging content to a console window.
It enables interactive debugging of a Client-Server process, for instance: you can interact with the Client, then look in real time at the server console window, and inspect which requests are processed, without the need to open the log file.

Depending on the events, colors will be used to write the corresponding information. Errors will be displayed as light red, for instance.

Continue reading...

2012, Sunday September 9

Synopse mORMot framework 1.17

Our Open Source mORMot framework is now available in revision 1.17.

The main new features are the following:

We have some very exciting features on the road-map for the next 1.18 release, like direct Event/CallBacks handling.
Stay tuned!

Continue reading...

2012, Monday May 28

Synopse mORMot Framework 1.16

Our Open Source mORMot framework is now available in revision 1.16.

The main new features are the following:

Thanks to its features, mORMot is now able to provide a stand-alone Domain-Driven Design framework for Delphi.

Quite a long and nice road for a little mORMot, and more to come!

Continue reading...

2012, Friday April 13

Custom JSON serialization of any class

By default, our mORMot framework is able to serialize any class into a true JSON object.

All published properties will be written as JSON object members.

In some cases, it may be handy to have a custom serialization, for instance if you want to manage some third-party classes, or to adapt the serialization scheme to a particular purpose, at runtime.

Continue reading...

2011, Sunday September 25

Synopse SQLite3/mORMot framework 1.15

Our Client-Server ORM framework is now available in revision 1.15.

This is a major upgrade of the framework:

  • It is now called mORMot - so please update your T-Shirts or coffee cups ;)
  • It is able to use any Database engine back-end - in fact, it is SQLite3 powered, not SQLite3 limited;
  • In particular, direct OleDB and native Oracle have been implemented;
  • It makes use of the genuine SQlite3 Virtual Table mechanism everywhere to allow mixed access to any database engine;
  • New TModTime / TCreateTime kind of fields;
  • Enhanced stability, speed and multi-thread implementation;
  • Methods and functions have been enhanced, according to user feedback (thanks you all for your interest and forum posts!);
  • Extended documentation (more than 700 pdf pages), with new diagrams and a lot of new content;
  • New associated tools, like LogViewer or SynDBExplorer;
  • The SQLite3 core can now be used without our ORM - it has been updated to the latest 3.7.8 version;
  • Open Source (under GPL/LGPL/MPL license), running from Delphi 6 up to XE2.

Continue reading...

2011, Saturday August 20

Enhanced Log viewer

We already shipped a sophisticated set of logging classes some month ago.

Since then, its features have been enhanced, and the system has been deeply interfaced with our main ORM framework. Now almost all low-level or high-level operations can be logged on request.

But since the log files tend to be huge (for instance, if you set the logging for our unitary tests, the 6,000,000 unitary tests creates a 280 MB log file), a log viewer was definitively in need.

Continue reading...

2011, Tuesday June 7

Intercepting exceptions: a patch to rule them all

In order to let our TSynLog logging class intercept all exceptions, we use the low-level global RtlUnwindProc pointer, defined in System.pas.

Alas, under Delphi 5, this global RtlUnwindProc variable is not existing. The code calls directly the RtlUnWind Windows API function, with no hope of custom interception.

Two solutions could be envisaged:

  • Modify the Sytem.pas source code, adding the new RtlUnwindProc variable, just like Delphi 7; 
  • Patch the assembler code, directly in the process memory.

The first solution is simple. Even if compiling System.pas is a bit more difficult than compiling other units, we already made that for our Enhanced RTL units. But you'll have to change the whole build chain in order to use your custom System.dcu instead of the default one. And some third-party units (only available in .dcu form) may not like the fast that the System.pas interface changed...

So we used the second solution: change the assembler code in the running process memory, to let call our RtlUnwindProc variable instead of the Windows API.

Continue reading...

2011, Sunday June 5

Synopse SQLite3 Framework 1.13

This is a major step for the framework.

Among a lot of new features and bug fixes:

Open Source project, for Delphi 6 up to XE, licensed under a MPL/LGPL/GPL tri-license.

Continue reading...

2011, Saturday May 14

Virtual Tables in the SQLite3 framework

The SQlite3 engine has ability to create Virtual Tables from code. From the perspective of an SQL statement, the virtual table object looks like any other table or view. But behind the scenes, queries from and updates to a virtual table invoke callback methods on the virtual table object instead of reading and writing to the database file.

The virtual table mechanism allows an application to publish interfaces that are accessible from SQL statements as if they were tables. SQL statements can in general do anything to a virtual table that they can do to a real table, with the following exceptions:
- One cannot create a trigger on a virtual table.
- One cannot create additional indices on a virtual table. (Virtual tables can have indices but that must be built into the virtual table implementation. Indices cannot be added separately using CREATE INDEX statements.)
- One cannot run ALTER TABLE ... ADD COLUMN commands against a virtual table.
- Particular virtual table implementations might impose additional constraints. For example, some virtual implementations might provide read-only tables. Or some virtual table implementations might allow INSERT or DELETE but not UPDATE. Or some virtual table implementations might limit the kinds of UPDATEs that can be made.

Example of virtual tables, already included in the SQLite3 engine, are FTS or RTREE tables. A custom virtual table might represent in-memory data structures (like TSQLVirtualTableJSON, TSQLVirtualTableBinary). Or it might represent a view of data on disk that is not in the SQLite3 format (e.g. TSQLVirtualTableLog). Or the application might compute the content of the virtual table on demand.

Thanks to the generic implementation of Virtual Table in SQLite3, you can use such tables in your SQL statement, and even safely execute a SELECT statement with JOIN or custom functions, mixing normal SQLite3 tables and any other Virtual Table.

A dedicated mechanism has been added to the framework, beginning with revision 1.13, in order to easily add such virtual tables with pure Delphi code, just by inheriting some classes.

Continue reading...

2011, Thursday April 14

Enhanced logging in SynCommons

Logging is everything... unless you never wrote a bug in your program! :)

Let us introduce a new logging class:

  • logging with a set of levels;
  • fast, low execution overhead;
  • can load .map file symbols to be used in logging;
  • compression of .map into binary .mab (900 KB -> 70 KB);
  • inclusion of the .map/.mab into the .exe;
  • reading of an external .map to add unit names and line numbers to a log file without .map available information at execution;
  • exception logging (Delphi or low-level exceptions) with unit names and line numbers;
  • optional stack trace with units and line numbers;
  • methods or procedure recursive tracing, with Enter and auto-Leave;
  • high resolution time stamps, for customer-side profiling of the application execution;
  • set / enumerates / TList / TPersistent / TObjectList / TContainer / dynamic array JSON serialization;
  • per-thread or global logging;
  • multiple log files on the same process;
  • integrated log archival (in zip or any other format);
  • Open Source, works from Delphi 6 up to XE.

Continue reading...