[Humble] Upcoming behavior change: Improved log file flushing in rcl_logging_spdlog

Summary

The ROS PMC has approved backporting an improved log file flushing behavior to ROS 2 Humble. This change will be included in an next Humble sync and affects how rcl_logging_spdlog flushes log data to the filesystem.

What’s Changing?

Previously, rcl_logging_spdlog did not explicitly configure flushing behavior, which could result in:

  • Missing log messages when an application crashes
  • Empty or incomplete log files during debugging sessions

After this update, the logging behavior will:

  • Flush log files every 5 seconds (periodic flush)
  • Immediately flush on ERROR level messages (flush on error)

This provides a much better debugging experience, especially when investigating crashes or unexpected application terminations.

Compatibility

  • :white_check_mark: API/ABI compatible — No rebuild of your packages is required
  • :warning: Behavior change — Log files will be flushed more frequently

How to Revert to the Old Behavior

If you need to restore the previous flushing behavior (no explicit flushing), you can set the following environment variable:

export RCL_LOGGING_SPDLOG_EXPERIMENTAL_OLD_FLUSHING_BEHAVIOR=1

Note: This environment variable is marked as EXPERIMENTAL and is intended as a temporary measure. It may be removed in future ROS 2 releases when full logging configuration file support is implemented. Please do not rely on this variable being available in future versions.

Related Links

Questions or Concerns?

If you experience any issues with this change or have feedback, please:

Thanks,
Tomoya

4 Likes

As a side note, this behavior has been present in Jazzy and Kilted since forever, so this change really only affects Humble.