chia-blockchain icon indicating copy to clipboard operation
chia-blockchain copied to clipboard

Use ISO8601 extended format with time zone for log timestamps

Open altendky opened this issue 2 years ago • 14 comments

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.

altendky avatar Oct 17 '21 02:10 altendky

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 ..

altendky avatar Oct 17 '21 03:10 altendky

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.

arvidn avatar Oct 18 '21 16:10 arvidn

the time zone doesn't change either, so it seems quite unnecessary to print it on every line

arvidn avatar Oct 18 '21 16:10 arvidn

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

emlowe avatar Oct 18 '21 16:10 emlowe

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.

altendky avatar Oct 18 '21 17:10 altendky

@wjblanke, you tend to be sensibly concerned about backwards compatibility. Thoughts here? Would this need to be configurable?

altendky avatar Nov 05 '21 03:11 altendky

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.

arvidn avatar Nov 05 '21 06:11 arvidn

Are we ready to merge this so we can close out #8802

paulhainsworth-chia avatar Nov 11 '21 22:11 paulhainsworth-chia

Kick CI for a fresh merge/build.

altendky avatar Nov 12 '21 01:11 altendky

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.

github-actions[bot] avatar Dec 27 '21 11:12 github-actions[bot]

any idea if this breaks tools that rely on parsing our logs, like chiadog?

trepca avatar Aug 17 '22 07:08 trepca

I do not know.

altendky avatar Aug 17 '22 14:08 altendky

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Sep 12 '22 23:09 github-actions[bot]

Conflicts have been resolved. A maintainer will review the pull request shortly.

github-actions[bot] avatar Sep 13 '22 00:09 github-actions[bot]

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Sep 30 '22 22:09 github-actions[bot]