Ask Your Question
0

rosconsole: How to include file and line number in log output

asked 2016-06-28 06:11:02 -0600

Michael Kopp gravatar image

TLDR: How can I include file name and line number in ros logging information that is sent to stdout when launching a node.

It seems like the ROS_LOG macros would store the file name (__FILE__) and line number (__LINE__) from where the ROS_LOG was used. Is there a way to include that information in the normal output to screen? I know that I can see it in rqt_console.

I tried to dig into how rosconsole uses log4cxx and only found, that log4cxx::Logger::forcedLog(..) is used to pass the log message to log4cxx where a log4cxx::spi::LocationInfo object contains the file name and line number. I assume, I'll have to find the log4cxx _layout_ that is used to generate the output printed to screen and somehow change it to make use of the file name and line number.

Could someone please help me to (a) find where this layout needs to be specified and (b) how to set it to include file name and line number?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-06-28 06:30:20 -0600

gvdhoorn gravatar image

Please refer to wiki/rosconsole - Console Output Formatting:

rosconsole allows you to specify how you'd like its output to show up in the console output through the ROSCONSOLE_FORMAT environment variable.

See the wiki page for the available options.

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

1 follower

Stats

Asked: 2016-06-28 06:11:02 -0600

Seen: 340 times

Last updated: Jun 28 '16