admin管理员组

文章数量:1384497

Sometimes, I write info to the debug log to diagnose problems. While working on a performance problem, resolution to hours:minutes:seconds is not enough. I'd like to get to milliseconds, but haven't yet found the place to make the change. Ideas?

FWIW, this is what the default timestamp looks like: [08-May-2020 23:16:38 UTC]

THANKS for any advice.

Sometimes, I write info to the debug log to diagnose problems. While working on a performance problem, resolution to hours:minutes:seconds is not enough. I'd like to get to milliseconds, but haven't yet found the place to make the change. Ideas?

FWIW, this is what the default timestamp looks like: [08-May-2020 23:16:38 UTC]

THANKS for any advice.

Share Improve this question asked May 8, 2020 at 23:50 Bob EastonBob Easton 1231 silver badge7 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

WordPress does not manage the format of the timestamp. Instead, WordPress hands off error message contents to the PHP function error_log(), which creates the timestamp.

Finding no easy way to ask error_log() for higher resolution timestamp, combined with the fact that I'm creating the message content myself, I've added a microsecond string ahead of my messages, essentially like this:

error_log( gettimeofday()['usec'] . ' ' . $message );

本文标签: phpHow can precision be improved for the debug log timestamp