Supercharge your ROS Console Experience


Here I provide a number of pro-tips for effectively using ROS via the command line…

One of the default settings in ROS is in my opinion silly – the data output on the command line. By default you get messages like this:

[ WARN] [1452803483.557258850]: Collision detected

But it could be so much better, like this:

ros.generic_vel_controller.cart_path_planner: Collision detected

Notice how it tells you what package the warning is coming from? And even what class?

How To Get This Extra Output Magic?

Its not very hard. First, add to you .bashrc file at the bottom:

export ROSCONSOLE_FORMAT='${logger}: ${message}'

Now you can see the namespace of your logged message.

Dave, how do I persistently turn on and off logging messages?

I’m glad you asked. My second pro-tip is a way to easily turn on and off debug and other log messages that doesn’t get erased between node launches. The current way ROS’s tutorials advise you to do this is by using the cumbersome RQT ROS Console widget – one of its problems is that all console settings get reset when you re-launch your node, which prevents you from seeing startup debug output. To fix this:

1. Create a file such as ~/.rosconsole
2. Inside that file, turn on ALL DEBUG MESSAGES by adding the following line:


3. Add a reference to that file in your .bashrc:

export ROSCONSOLE_CONFIG_FILE=~/rosconsole.yaml

4. Re-source your .bashrc
5. Now when you run your ROS nodes, you should see a ton of logging coming out. Too much? I agree. You can individually turn off debug output as you see fit. A good starting point is to turn off roscpp comm and rviz output. Add to your ~/rosconsole.yaml file:


6. Save and rerun your ROS nodes. You should have less output.
7. Repeat suppressing more output as you see fit by copying the above line and replacing “roscpp” with the namespace seen on the command line. If for some reason I wanted to suppress the warning in the example at the top, and only show errors, I would add:


And how about sub-namespacing log messages?

Want more? For very large packages that have tons of classes and code, its helpful to use sub-namespacing for your log messages. This is demonstrated in the example at the top where it says “cart_path_planner”. To get this, you’ll need to slightly alter your code.

1. Instead of using just ROS_WARN or similar, you should use:

ROS_WARN_NAMED("cart_path_planner", "Collision detected");

2. Recompile :)

For more information on how this all works, see the ROS’ logging documentation

Bookmark the permalink.
  • Alexander Meisel

    Do have any experience with log4j.appender.ConsoleAppender.layout.ConversionPattern for the ROS console?

    I want or modify the time in the logging.

    • no, ive not heard of that actually