Show Log in chronological order

Service Center
On our radar

Using the asynchronous logging API is very useful but can get confusing when a number of items are logged in quick succession.  The API buffers the log entries as they occur but only writes them to the database after a short period.  The result is that we will view the faster events in chronological order (latest on bottom) but slower events in reverse chronological order (latest on top)

Would it be pssible to buffer the events in REVERSE order so that the overall log is always shown in reverse chronological order (latest on top)

Created on 14 Aug 2017
Comments (1)

You should never, ever count on "order of insertion" in a SQL database. EVER.


Because there is no guarantee that *order of retrieval* will be the same. This is a basic rule of SQL: "never assume the order unless you specified the order". You also cannot depend on the IDs being sequential, so don't sort on IDs either.

You should add an attribute for the date/time of the record, populate it with CurrDateTime() when you generate the record and send it to asynchronous logging, and then sort on this field when you display it.