I noticed that the xdebug log time is always two hours too early. For example it says the log is created at 7:15 am even though it is 9:15 am.
If I execute
date in my terminal, then I get 9:15 am
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Based on your comment regarding the current time being
Thu Aug 1 15:13:26 CEST 2019, my theory is that the xdebug log is running (or logging) in UTC, which is two hours earlier than CEST. It's unfortunate that the timezone doesn't appear to be part of the output; that leaves the actual time ambiguous for any cross-referencing, as you've seen.
I found a Stack Overflow post that mentions setting the
date.timezone value to your desired timezone. It also says:
It is always better to load xdebug extension at the end of file(php.ini).
The list of php.ini directives indicates that the default value for
date.timezone is empty, which presumably falls back to UTC.
My suggestion, since
CEST is not a valid value, would be to pick your region from this list of valid PHP European timezones (or Antarctica or Africa, as appropriate). For more, see the full list of timezones supported by PHP.
I couldn't get this to work, even with my
date.timezone set in
xdebug.ini loaded afterwards.
My Xdebug log (no longer called "remote log" in Xdebug 3) was still showing
UTC time. I couldn't find any way to change this other than by editing the Xdebug source and recompiling. I don't see anything in the source code for Xdebug that would convert time to local time, so maybe this is the only way.
See my stackoverflow answer to my own question for more details. But here's the gist.
All I had to do was change
char* xdebug_nanotime_to_chars around line 196.
And that works, but I wanted the timezone code printed in the log.
To do that, I had to make a few more changes. I made a function to return the timezone string, then added that function into the log open/close functions in the same file (