Ask Your Question

edit logger levels programmatically or from the command line

asked 2011-08-31 04:27:07 -0500

ben gravatar image

I searched around on this site, the roscpp/logging page and on the rosconsole wiki page but as far as I can tell there are two obvious ways of changing the logger level and they are:

  1. using rxloggerlevel (maybe through rxconsole too?)
  2. modifying the ROSCONSOLE_CONFIG_FILE

Now, I just found this page, and it told me that using roscpp I can programmatically change the logger level as in rosconsole/examples/example.cpp. So, in writing this question I figured out half of my question but I thought I might as well ask this anyway:

Is there a way to modify the logger level from the command line? Something along the lines of:

roslog {package_name/logger} {logger level}

ex. "roslog sbpl DEBUG" or "roslog sbpl/my_log DEBUG"

Regarding, changing the logger level programmatically, I'll follow the example code and post any questions here if it doesn't work as expected.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2011-08-31 05:25:01 -0500

kwc gravatar image

@bhaskara's comment answers this ticket, I think. rosservice call is the way to set the logger level, i.e.

 rosservice call $n/set_logger_level $1 $2

It can also be useful to call get_logger_level to determine the possible logger level values.

I personally prefer to do this in rosh as I find it easier to tab-complete and also read the arg specs.

As also noted, this doesn't work for rospy, but I think that's not implied in the original question.

edit flag offensive delete link more

answered 2011-08-31 04:30:50 -0500

tfoote gravatar image

I don't think there is a way to do that at the moment. The roscpp implementation would support it as it does in rxconsole. rospy doesn't support on the fly logging level changes at the moment. This sounds like a great enhancement ticket candidate.

edit flag offensive delete link more


Thanks Tully. I filed a ticket here:
ben gravatar image ben  ( 2011-08-31 04:39:49 -0500 )edit
Note that for roscpp at least, you just need a script that looks something like: for n in `rosnode list`: rosservice call $n/set_logger_level $1 $2
bhaskara gravatar image bhaskara  ( 2011-08-31 05:11:52 -0500 )edit

Your Answer

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

Add Answer

Question Tools


Asked: 2011-08-31 04:27:07 -0500

Seen: 2,515 times

Last updated: Aug 31 '11