There's a reason for logging time in UTC. Many time zones use daylight saving time. For those zones, there's an hour in the spring that is skipped, and an hour in the fall that is duplicated. If you were to log using the local time, there would not be an easy way to disambiguate between the duplicated values.
For example, if you are in the US Eastern time zone ("America/New_York"
) and you logged using local time, a value like 2014-11-02 01:30:00 could mean either 1:30 in Eastern Daylight Time, or 1:30 in Eastern Standard Time - an hour later.
If you log frequently enough, you might be able to detect this by comparing the timestamps of other items in nearby log entries. But in general, that's not a great solution because you might only log occasionally, or you might not want the overhead of analyzing more than one log entry at a time.
Besides daylight saving time - there's also the issue that if you take log files from multiple servers, they should be able to be compared uniformly. Perhaps I have web servers on the US East coast and West coast, one in Europe, and one in Japan. If there's a spike in my global traffic - I shouldn't have to do time zone conversions to line things up.
If you really must log in local time - then consider including the offset from UTC along with the timestamp. This is known as a "DateTimeOffset" in some languages, and is also part of the ISO-8601 standard. For example, "2014-06-20T01:23:45-07:00"
. By doing this, you at least allow for conversion back to UTC and remove any ambiguity caused by daylight saving time.
I don't know if there's a specific way to have WordPress or PHP log in this manner, but perhaps someone else can offer that as a separate answer.