Logging Data Streams
For logging arbitrary data travelling over ROS Topics, ROS provides a tool called rosbag which can aggregate, record, and play back ROS messages. There are also CLI and GUI tools (rosbag, rqt_bag) for manipulating bag files.
The rosbag tools act like any other ROS nodes so log data can be combined with live data interchangeably if communicating over ROS interfaces.
Aggregated Log Messages
ROS provides a topic-based logging framework called rosout. As the name suggests, this can be treated like stdout and stderr but can be aggregated locally and over the network. rosout provides info, debug, warn, error, and fatal log levels as well as CLI GUI tools (rosconsole, rqt_console) for viewing and filtering log messages.