@patrickbr opened this Issue on July 23rd 2017 Contributor

Piwik sets the PHP timezone to "UTC" by default (see here), overwriting the machines real timezone and the one that is configured in PHP.ini. While you may have good reasons to do this, one nasty side-effect is that the timestamps in the log file are also in UTC and not in the machine's timezone. This causes significant problems if the logfile is read by other applications (for example, fail2ban with this plugin). It is also just plain confusing, looks a bit unprofessional and makes it hard to harmonize logs.

The reason for this behavior is of course that Monolog uses date_default_timezone_get() to get the timezone it writes the logs in (see here).

This problem could be very easily fixed by using the setTimezone(DateTimeZone $tz) method provided by the Monolog logger. An approach could be: store the timezone configured in PHP core/bootstrap.php before setting it to 'UTC' and give that stored timezone to Monolog during initialization.

@mattab commented on July 24th 2017 Member

Thanks for the suggestion, I understand your point of view, but we log times in UTC by design because it is actually a best practise (at least for some of us). Once you have worked with servers all over the world in all different timezones, and you need to communicate to people in different timezones about servers in other timezones, It's not confusing to have times in UTC. It makes life much easier in the end.

This Issue was closed on July 24th 2017
Powered by GitHub Issue Mirror