Ask Your Question
1

Finding node log file location programmatically

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

rsafonov gravatar image

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

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 -0500 )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 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

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

Eman gravatar image

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

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 -0500 )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 -0500 )edit

Thank you. I have edited my original question.

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

answered 2016-12-12 12:42:08 -0500

dsolomon gravatar image

updated 2016-12-12 12:42:49 -0500

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 5,972 times

Last updated: Dec 12 '16