No stdout logging output in ROS2 using launch
Hi all,
I am unable to see any logging output from stdout when using ros2 launch
, and I need some help figuring out what's going on / if this is expected. For example this cpp file:
int main(int argc, char** argv)
{
rclcpp::init(argc, argv);
auto node = std::make_shared<rclcpp::Node>("a_test_node");
RCLCPP_DEBUG(node->get_logger(), "test log debug");
RCLCPP_INFO(node->get_logger(), "test log info");
RCLCPP_WARN(node->get_logger(), "test log warn");
RCLCPP_ERROR(node->get_logger(), "test log error");
rclcpp::spin(node);
return 0;
}
and this launch file:
import launch
import launch_ros.actions
def generate_launch_description():
return launch.LaunchDescription([
launch_ros.actions.Node(
package='test_pkg',
node_executable='test_node',
node_name='test_node',
output={
'stdout': 'screen',
'stderr': 'screen',
}
),
])
only outputs:
jlangsfeld@swri-jlangsfeld-thinkpad-T560:~/Workspaces/ros2$ ros2 launch test_pkg log_test.launch.py
[INFO] [launch]: All log files can be found below /home/jlangsfeld/.ros/log/2019-09-11-13-45-19-657412-swri-jlangsfeld-thinkpad-T560-18153
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [test_node-1]: process started with pid [18163]
[test_node-1] [WARN] [test_node]: test log warn
[test_node-1] [ERROR] [test_node]: test log error
I've tried other output
options too with no luck. For example, using own_log
for both stdout and stderr means separate log files are created but the stdout one always is completely empty. Any thoughts / suggestions?
Thanks, Josh
can you try
output="screen"
without the json? That's what I usually doex. https://github.com/ros-planning/navig...
I see the warn and error, but not info, perhaps because you didnt set to screen in general
Yes, I've tried the single string, which should just be a shortcut for setting both stdout and stderr directly. Are you saying you don't see info outputs either when you run launch files?
No, I do see them with just the simple string
in foxy, log can output to ~/.ros/log.
but i found there is a delay time to log file than screen, i found log file will increase 4096kb every time, so is it flush when buffer is fulled ?
how to set immedialy output every line ?