-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change flushing behavior for spdlog log files, and add env var to use old style (no explicit flushing) #95
Conversation
… old style (no explicit flushing) Signed-off-by: William Woodall <[email protected]>
I also ran the (micro)benchmark tests with and without this change, but didn't see a difference:
Though it was with a debug build and I'm not 100% sure the benchmarks cover all cases, or cases where this would impact performance (rapid error messages being logged). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with green CI!
I have left some minor suggestions
Working on the doc changes (release notes, etc). |
Signed-off-by: William Woodall <[email protected]>
With the latest changes in place, this is functioning like I expect. So I decided to do some testing. In particular, I went back and repeated the test where I modified the talker to publish and print every 1 millisecond. To start with, I wanted to measure the overhead of running the timer and publisher at this frequency, without any overhead from the
(that is, disable output to I then reenabled just the external library (the spdlog logger), by running:
Now the talker is taking about 41% CPU. Next I went back and checked out I should note that all of this was on my Raspberry Pi 4 with a slow SD card. Thus, I'm more confident that this change should have minimal overhead. As far as I'm concerned, this is good to go in once @scpeters concerns have been addressed. |
Thanks for the extra testing @clalancette! |
Signed-off-by: William Woodall <[email protected]>
Docs update: ros2/ros2_documentation#3193 |
I made a release for this: ros/rosdistro#35370 |
* release note about change to log file flushing ros2/rcl_logging#95 * mention the volatility of the env var * Apply suggestions from code review Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Audrow Nash <[email protected]> * emphasize note about experimental status also link to issue about logging config file plans Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Audrow Nash <[email protected]>
* release note about change to log file flushing ros2/rcl_logging#95 * mention the volatility of the env var * Apply suggestions from code review Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Audrow Nash <[email protected]> * emphasize note about experimental status also link to issue about logging config file plans Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Audrow Nash <[email protected]> (cherry picked from commit 2002bbd)
* release note about change to log file flushing ros2/rcl_logging#95 * mention the volatility of the env var * Apply suggestions from code review Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Audrow Nash <[email protected]> * emphasize note about experimental status also link to issue about logging config file plans Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Audrow Nash <[email protected]> (cherry picked from commit 2002bbd)
* release note about change to log file flushing ros2/rcl_logging#95 * mention the volatility of the env var * Apply suggestions from code review Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Audrow Nash <[email protected]> * emphasize note about experimental status also link to issue about logging config file plans Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Audrow Nash <[email protected]> (cherry picked from commit 2002bbd)
* release note about change to log file flushing ros2/rcl_logging#95 * mention the volatility of the env var * Apply suggestions from code review Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Audrow Nash <[email protected]> * emphasize note about experimental status also link to issue about logging config file plans Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Audrow Nash <[email protected]> (cherry picked from commit 2002bbd) Co-authored-by: William Woodall <[email protected]>
* release note about change to log file flushing ros2/rcl_logging#95 * mention the volatility of the env var * Apply suggestions from code review Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Audrow Nash <[email protected]> * emphasize note about experimental status also link to issue about logging config file plans Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Audrow Nash <[email protected]> (cherry picked from commit 2002bbd) Co-authored-by: William Woodall <[email protected]>
* release note about change to log file flushing ros2/rcl_logging#95 * mention the volatility of the env var * Apply suggestions from code review Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Audrow Nash <[email protected]> * emphasize note about experimental status also link to issue about logging config file plans Co-authored-by: Ivan Santiago Paunovic <[email protected]> Co-authored-by: Audrow Nash <[email protected]> (cherry picked from commit 2002bbd) Co-authored-by: William Woodall <[email protected]>
While working on a project we noticed some applications have missing log messages or no log file at all when it crashes. This isn't a good experience for users when debugging, so this pr changes the flushing behavior of spdlog to flush every five seconds as well as anytime the error log level is used.
A new environment variable is introduced to allow users to opt-out of this back to the old behavior (no explicit configuration) and is meant to be temporary until we support full config files (planned work).
The new env var is called
RCL_LOGGING_SPDLOG_EXPERIMENTAL_OLD_FLUSHING_BEHAVIOR
and setting it to1
will get you the old behavior. I'm very open to other names, but the "EXPERIMENTAL" is in there in part to indicate we would like to remove this in the future in favor of the config files, i.e. this is experimental and you cannot rely on it in the next version of ROS.