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