Robotics StackExchange | Archived questions

How to configure ROS_INFO to print a human readable time?

Hello,

I want to change how the ros logger works from this:

[ INFO] [1461311729.886215631]: ProblemPublisher(): source="Navigation"

to this:

[ INFO] [2016-04-22 07:55:29,508]: ProblemPublisher(): source="Navigation"

It should be possible to do this in $ROS_ROOT/config/rosconsole.config by adding something like this:

log4j.appender.ConsoleAppender.layout.ConversionPattern=[%-5p] %d %c - %m%n

But nothing changes. is it the wrong file or the wrong appender?

Thanks for the help!

Asked by Orchaldir on 2016-04-22 03:13:51 UTC

Comments

Good question! I don't have an answer, only a small comment: you shouldn't modify files in $ROS_ROOT. Instead, you can point the environment variable ROSCONSOLE_CONFIG_FILE to a .rosconsole-config file in your home directory.

Asked by Martin Günther on 2016-04-22 03:42:28 UTC

Thanks! I would have done that later, but I just wanted to quickly test it.

Asked by Orchaldir on 2016-04-22 03:57:17 UTC

No problem! Another partially related comment: You can change the output format using the ROSCONSOLE_FORMAT environment variable. That doesn't do what you want; I still thought I'd mention it.

Asked by Martin Günther on 2016-04-22 06:15:20 UTC

That only allows to a limited amount of modifications. I am more interested in Configuration.

Asked by Orchaldir on 2016-04-22 06:25:28 UTC

Yes, I thought so. I just thought it might help if you knew about that, but apparently you already do. :)

Asked by Martin Günther on 2016-04-22 06:57:09 UTC

Nice question! I do need the real date and time too for debugging. But I still don't know how can I do it correctly and I wonder why the rospy logs do contain the date but those of cpp nodes don't. It would be very kind to answer your question and share the config file you've come up with. Thanks!

Asked by Jasmin on 2017-10-13 03:29:43 UTC

Answers