ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Finding node log file location programmatically

asked 2013-12-05 08:19:47 -0600

rsafonov gravatar image

updated 2014-04-20 14:09:46 -0600

ngrennan gravatar image

Is it possible to programmatically find location of the log file where my current ros node is writing? I am using ros groovy. I would like to find the location of the log file from my C++ code, not from the terminal. I think I found how to find the log file directory by using ros::file_log::getLogDirectory(). However this does not give me the log file name.

edit retag flag offensive close merge delete

Comments

Thank you very much for your answer. However my question was different. I would like to find the location of the log file from my C++ code, not from the terminal. I think I found how to find the log file directory by using ros::file_log::getLogDirectory(). However this does not give me the log file name.

rsafonov gravatar image rsafonov  ( 2013-12-05 10:45:43 -0600 )edit
1

It may help if you tag c++ & other tags that related to your question in your original question

Eman gravatar image Eman  ( 2013-12-05 12:38:26 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-12-05 10:37:10 -0600

Eman gravatar image

updated 2013-12-05 10:45:33 -0600

you can

  • type command roscore in the terminal

  • then open another separate new
    terminal & type command roscd log

roscd log will take you to the folder where ROS stores log files

edit flag offensive delete link more

Comments

Thank you very much for your answer. However my question was different. I would like to find the location of the log file from my C++ code, not from the terminal. I think I found how to find the log file directory by using ros::file_log::getLogDirectory(). However this does not give me the log file name.

rsafonov gravatar image rsafonov  ( 2013-12-05 10:46:38 -0600 )edit

not at all I am sorry if I can't help you . I hope to solve it soon You can declare your question by editting that what you mentioned about" you want to find the location of the log file from your C++ code, not from the terminal. I think I found how to find the log file directory by using ros::file_log::getLogDirectory(). However this does not give me the log file name." to your original question

Eman gravatar image Eman  ( 2013-12-05 10:53:10 -0600 )edit

Thank you. I have edited my original question.

rsafonov gravatar image rsafonov  ( 2013-12-05 11:02:30 -0600 )edit
0

answered 2016-12-12 12:42:08 -0600

dsolomon gravatar image

updated 2016-12-12 12:42:49 -0600

Note: I know this is an old post, hopefully this answer helps other people who come across it.

Part of the problem may be in a misunderstanding of how log files are being generated. In a normal running ROS system, there is a node named rosout that receives all log messages via message interface and writes them to <logging_directory>/rosout.log.

Additionally, one can choose to have roslaunch redirect a node's ROS_DEBUG/INFO/WARN terminal output to file, using the "output" field in the "node" xml (allowable values are "screen" and "log"). If the output field is set to log, roslaunch will redirect that node's (via the pid) terminal output to <logging_directory>/<node>_stdout.log.

In summary, typically only the rosout and roslaunch executables actually write log files. This would explain why you cannot find a reference to the log file for that node from within the executable.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2013-12-05 08:19:47 -0600

Seen: 6,543 times

Last updated: Dec 12 '16