-
Notifications
You must be signed in to change notification settings - Fork 168
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
Log file is exclusively named after process name in both rclpy
and rclcpp
#856
Log file is exclusively named after process name in both rclpy
and rclcpp
#856
Comments
rclpy
based processrclpy
and rclcpp
ROS 2 can have multiple nodes in the same process space, so node name would not be suitable for log file name. current implementation uses program name for the log file name, and, i think using program name is fine ( something we can do is replace program name with |
I see -- thank you! So each file is specific to a process? In that case, I think using the script name could work as a first pass. Ideally, there would also be a way to configure the logger name in |
allowing user application to set the log file name sounds reasonable for me. user application can set the unique identification to the log file that is easy to search the log file. (e.g environmental variable,
i am not sure if that option is available for |
rclpy
and rclcpp
rclpy
and rclcpp
rclpy
and rclcpp
rclpy
and rclcpp
@fujitatomoya As regards
Could you please clarify what you mean by that or in what place we could potentially do this? |
I would consider adding one extra parameter const char * program_name to the
and to the
To be able to provide |
root 388 385 3 20:20 pts/2 00:00:01 /usr/bin/python3 /root/ros2_ws/colcon_ws/install/demo_nodes_py/lib/demo_nodes_py/talker
|
@fujitatomoya Sorry still didn't get how you replaced the program name with argv[1] ? |
@MichaelOrlov oh, that is just an idea to replace |
This comment was marked as off-topic.
This comment was marked as off-topic.
@sea-bass could you try,
it works in my local environment. root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 run demo_nodes_py talker --ros-args --log-file-name foobar
[INFO] [1702509980.781646208] [talker]: Publishing: "Hello World: 0"
...
root@tomoyafujita:~/.ros/log# ls -lt
total 328
-rw-r--r-- 1 root root 0 Dec 13 15:26 foobar_585207_1702509979643.log |
This is great -- thank you for the update! Would the path forward to specify this from launch files to similarly add to the ROS args using the existing launch APIs? |
yeah, it should be, that was the intention. along with other arguments such as i think we need to add those test cases for |
@clalancette i got a few follow-up PRs to close this issue. could you review these? |
This issue has been mentioned on ROS Discourse. There might be relevant details there: https://discourse.ros.org/t/ros-2-jazzy-jalisco-released/37862/1 |
Bug report
Required Info:
Steps to reproduce issue
When I run the following command:
Expected behavior
I would expect looking into my ROS logs folder, e.g.,
~/.ros/log
and seeing a log file named after the node (my_talker
).e.g.
my_talker_96363_1695751593253.log
Actual behavior
However, I am instead seeing a generic Python name:
python3_96363_1695751593253.log
This makes it very inconvenient to search for logs by node name, which should be the case.
Additional information
Running
ros2 node list
shows this node name correctly; it's just the logger that is wrong:Additionally, this also happens with
rclcpp
based nodes but in a different way.For example
yields the following log file name:
... which is the default node name, but this should be as follows, right?
Feature request
The node name should actually be used in the log file names created from
rclpy
nodes, as described in the "Expected Behavior" section above.The text was updated successfully, but these errors were encountered: