chia-blockchain
chia-blockchain copied to clipboard
Use ISO8601 extended format with time zone for log timestamps
https://en.wikipedia.org/wiki/ISO_8601
Existing: 2021-10-16T22:50:30.453 full_node full_node_server : INFO
New : 2021-10-16T22:49:25.210-04:00 full_node full_node_server : INFO
Closes https://github.com/Chia-Network/chia-blockchain/issues/8802.
I went ahead and made the code, but I don't know how much we want to consider backwards compatibility for log-parsing tools with this sort of change. Also, this makes the code slightly more complicated, which isn't a big deal, but if we were willing to have microseconds instead of milliseconds I think it would actually make the new code a bit simpler than the original. Also I'll note that https://en.wikipedia.org/wiki/ISO_8601 seems to suggest that there... was a preference for a ,
fractional separator. Or maybe still is "within International Standards", whatever exactly that means. As coded, it still uses a .
.
I would think a better direction to go in would be to print the date every time it changes, and on other log lines only include the 24 hour wall clock time (without date). A large portion of the screen space is wasted on repeating the same date over and over again now, when looking at logs.
the time zone doesn't change either, so it seems quite unnecessary to print it on every line
Not printing it on every line does defeat the original purpose of the change though - which is to support streaming the logs to some log ingester like grafana (#8802) - which presumably needs each line to be completely self-contained.
It's fairly typical to either include the timezone on the line (Common Log Format) - or to always use a standard TZ like GMC/UTC.
There are probably other ways for the end-user to solve this though, so I'm not sure about making the change
Time zones can be changed. If referring to the offset, then for lots of places the laws change it a couple times a year. Not having this information is a pain when trying to do many things other than just glancing at your own log. For example, when I share logs with a pool and compare with other user's logs I have to remind them to check and share their system's offset.
@wjblanke, you tend to be sensibly concerned about backwards compatibility. Thoughts here? Would this need to be configurable?
I've we're mostly concerned about this being machine-readable, using posix-time as timestamp would probably be best. No need to worry about time-zones or other head-aches that come with civic time, and it's short. Humans reading the logs will appreciate the screen-space.
The timestamp wouldn't be very human-friendly though.
Are we ready to merge this so we can close out #8802
Kick CI for a fresh merge/build.
This PR has been flagged as stale due to no activity for over 60 days. It will not be automatically closed, but it has been given a stale-pr label and should be manually reviewed by the relevant parties.
any idea if this breaks tools that rely on parsing our logs, like chiadog?
I do not know.
This pull request has conflicts, please resolve those before we can evaluate the pull request.
Conflicts have been resolved. A maintainer will review the pull request shortly.
This pull request has conflicts, please resolve those before we can evaluate the pull request.