admin管理员组文章数量:1193775
I look at the debug.log file a lot while developing, and having all the timestamps in UTC drives me crazy! How can I get them to display in local time? I have my php.ini 'date_timezone' value set to 'America/Los_Angeles' already.
I look at the debug.log file a lot while developing, and having all the timestamps in UTC drives me crazy! How can I get them to display in local time? I have my php.ini 'date_timezone' value set to 'America/Los_Angeles' already.
Share Improve this question asked Oct 16, 2015 at 23:12 eljefejbeljefejb 6512 gold badges7 silver badges16 bronze badges 3- Same problem here.. have you figured out how to do this? – neoDev Commented Jan 22, 2018 at 8:11
- Nope. Neither WordPress nor PHP settings seem to have any effect. :( – eljefejb Commented Jan 22, 2018 at 16:38
- @neoDev, in case you never figured this out, I just posted my answer below with a code snippet that you can use as an alternative – Michael Commented Jan 22, 2021 at 21:27
3 Answers
Reset to default 2What is the time zone setup in your admin -> settings -> general page? WordPress overrides & kind of disregards php's timezone & uses this own settings , if haven't set this - default is UTC+0
Update: according to https://core.trac.wordpress.org/ticket/39595 - wordpress has forced this to be UTC
You can retrieve the debug.log, convert the dates yourself, and display the results in your admin area.
I did this for a plugin I made, but have changed the code slightly to display the debug.log in a custom Dashboard widget so someone else can use it.
It will also highlight lines that contain issues from the functions.php file, as well as an additional keyword through a query string search. The code can be found here:
https://gist.github.com/mrgandy/8b6c198d8abf30d3f4e9def7300cc60c
Just set the preferred timezone in functions.php. That's it.
date_default_timezone_set('Asia/Kolkata');
Change 'Asia/Kolkata' with your preferred timezones. PHP Official timezone
It's recommended to use child-theme to preserve changes made in functions.php even after the theme gets updated.
本文标签: How to make debuglog timestamps local time
版权声明:本文标题:How to make debug.log timestamps local time? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738483338a2089275.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论