ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org

ROS2 Logging Format

Hi,

I threw out this PR on rcutils for changing the logging format by default to include the timestamp, which it currently is missing.

I was hoping to get some feedback from folks that this is something valuable on a general case. I can say in my experience the timestamps are critical to debug timing or see relative event times.

I’d like to hear from other people if they agree or disagree!

7 Likes

@smac

I do agree on your PR,
timestamp is really critical information for debugging between nodes and system.

1 Like

I don’t see a reason not to include timestamps and can think of many cases where the information is indeed very helpful.

Timestamp is often crucial indeed.

I’d even love to have ISO 8601 style datetime (to be exact d{dd-MM-yyyy HH:mm:ss.SSS}) instead of Unix timestamps, but that would require a few more changes I guess.

I wouldn’t be totally opposed to that, but it does bring in the ambiguity of the timezone. I like unix time to abstract out that background process in my mind of “ok, what time zone would this be in” when looking at logs for a machine potentially thousands of miles from me

2 Likes

I like that something like d{dd-MM-yyyy HH:mm:ss.SSS} would be more easy to read, but I do understand smacs concern of having to deal with timezones to some degree. However, is the timezone really an issue @smac? Your own argument for adding timestamps to logging is for easier debugging. Whether or not the timestamp matches the timezone you are currently in does not take away a lot from the added readability. On top of that I think it is quite easy to detect what timezone the system is in and doing some conversion at some point. Just brainstorming here.

yes, I’d say timezone is a really annoying thing to deal with. Also putting it in that format is harder to look at relative timing when I really just care about how many seconds (milliseconds, microseconds) passed between events. Its extremely rare that timing on the hours scale is all that interesting.

I agree with @smac’s approach. The purpose of the time stamp is less to understand when in absolute time things happened, and more to understand when they happened relative to system start and to each other, often at a very fine scale.

I really just care about how many seconds (milliseconds, microseconds) passed between events.

So do I. i would organize and sort date into files if needed.

Btw, https://github.com/ros2/rcutils/pull/190 has been merged.

1 Like