-
-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev/core#4270 createDebugLogger/ConfigAndLog: use a standard date format #27575
Conversation
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
Quick links for reviewers...
|
The issue associated with the Pull Request can be viewed at https://lab.civicrm.org/dev/core/-/issues/4270 |
Yes from me! |
Endorsed emphatically by @artfulrobot - mergeable on a thumbs up from @adixon or after a few days if no response |
Aside: strftime() that parses this date format is deprecated as of php8.1... |
@artfulrobot right - from what I understand, we are applying this PR from @seamuslee001 for PHP 8.1 compatibility: pear/Log#23 |
Yes please, break the log viewer! Any reason we can't add a timezone in that formatting string? |
@mlutfy ^ |
+1 for switching to Y-m-d +1 for adding |
I'd go for e.g. difference is
Various date parsing things can be troublesome with understanding timezones. e.g. Javascript Date API is implemented differently on Chromium and Firefox and supports different timezones. |
I went with For a moment I pondered on being more ISO8601 compliant by using the |
Yay! |
Just noting that this PR fixed the following PHP fatal error we had observed on sites when using CiviCRM 5.66.2 and CiviCRM 5.64.4 and PHP 8.1.
Posting here to help others with Googl'ing. Might want to fast track this release given that PHP 8.1 is now the recommended version. We suspect this problem only impacts non-US sites. Agileware Ref: CIVICRM-2187 |
@agileware-justin interesting, thanks for posting. If my calculations are correct 🧐 this change will be in the next stable, which I think is out this wed/thursday. |
Thanks @mlutfy |
@agileware-justin I would also add that it seems that something broke in a point release of PHP as @demeritcowboy found this php/php-src#12561 |
Yes @seamuslee001 that's the problem, right there - PHP 8.1.25 |
xkcd spot on yet again... |
FYI: next up: I'd like to (a) centralise all log calls to use Civi::log() and (b) prevent any civi logging funciton from storing binary data in the log files (which makes them hard to grep, amongst other annoyances). |
Overview
Discussion: https://lab.civicrm.org/dev/core/-/issues/4270
The CiviCRM "ConfigAndLog" logs use a weird custom format, which depends on the system/user's locale, so it can be, for example:
This format is difficult to parse.
Before
After
Technical Details
strftime is deprecated as of PHP 8.1, but PEAR Log seems to be using a shim for now.
Comments
I'd rather avoid the larger questions around logging. This is really just about the date format.
It might break extensions such as logviewer.
Example promtail (Grafana/Loki) config:
cc @adixon @artfulrobot