Robotics StackExchange | Archived questions

Why does rosconsole log look different than rosout.log

When I have the following environment variable:

ROSCONSOLE_FORMAT=[${severity}] [${time}] [${node}]: ${message}

This is the output to the terminal:

[ INFO] [1601445805.714924273] [/gnss_receiver]: node started

But in the .ros/log/latest/rosout.log it looks like this:

1601445805.714961571 INFO [.../gnss_receiver_node.cpp:105(main) [topics: /rosout] node started

Is there a way to format rosout.log?

Asked by borgcons on 2020-09-30 01:56:57 UTC

Comments

Answers

Hi @borgcons,

ROSCONSOLE_FORMAT allows you to specify how you would like the rosconsole output to show up in the terminal. Since it is a environment variable it will only affects the current shell you are using, although you can add it to the .bashrc.

On the other hand, the format with which the log is generated is harcoded in the rosout node, that subscribes to /rosout, logs the messages to file, and re-broadcasts the messages to /rosout_agg. Hence, if you want to change the output log, either you change that node (that is not recommended), accepts that format how it is or implement a new node (bare copy of the rosout node) that does the same thing but changing the format with the one you want.

Hope that helps you.

Regards.

Asked by Weasfas on 2020-10-02 05:21:46 UTC

Comments

Worth putting a stress: Since ROSCONSOLE_FORMAT is an environment variable, it can be defined in a launch file (I just added an example of defining without a config file) http://wiki.ros.org/rosconsole#Configuration

Asked by 130s on 2020-10-02 05:52:15 UTC