Bug #93830
closedWrong type for field `time_micro` in table `sys_log`
0%
Description
As we log some custom events to `sys_log` we installed the log extension https://gitlab.com/co-stack.com/co-stack.com/typo3-extensions/logs mentioned at https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Logging/Writers/Index.html.
The backend module sorts the log entries by the field `time_micro` of the table `sys_log`. However, the entries in this field getting stored not correctly because the type is defined as `float`
(https://github.com/TYPO3/TYPO3.CMS/blob/650d5d7ba771d2ad854f2475b7b7d4aff70c9d2c/typo3/sysext/core/ext_tables.sql#L384). While the real microtime in PHP was something like `1617029996.5212` I got `1617030000` in all records:
Changing the type to `decimal(14,4)` fixed the issue.
Files
Updated by Stefano Kowalke over 3 years ago
- Tags changed from database to database, logging,
- Complexity set to no-brainer
Updated by Martin Kutschker over 3 years ago
Seems to be some kind of rounding issue.
Ideally we had a portable SQL date field that has microseconds.
Updated by Andreas Kienast over 2 years ago
- Status changed from New to Needs Feedback
Hello Stefano,
can you please tell which database you're using and if this is still an issue? We were not able to reproduce the issue in v11 and v12 with MySQL 5.7 and MariaDB 10.2 with passing microtime(true)
.
Updated by Stefano Kowalke over 2 years ago
As I am not on that project anymore, I can't help about the current state of this issue. All I can say, that it happened with v10 and MariaDB. Maybe Sebastian Michaelsen can jump in here.
Updated by Christian Kuhn 12 months ago
- Status changed from Needs Feedback to Closed
Hey. I hope it's ok to close here:
Core defines the db field and writes floats to it as expected. The rendering of the log is part of the extensions, it's display and sorting should be fixed in there in case this is still an issue.