How to configure ROS_INFO to print a human readable time? [closed]

asked 2016-04-22 03:13:51 -0500

Orchaldir gravatar image

updated 2016-04-22 05:42:14 -0500


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!

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by tfoote
close date 2017-11-30 13:18:58.494974



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.

Martin Günther gravatar image Martin Günther  ( 2016-04-22 03:42:28 -0500 )edit

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

Orchaldir gravatar image Orchaldir  ( 2016-04-22 03:57:17 -0500 )edit

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.

Martin Günther gravatar image Martin Günther  ( 2016-04-22 06:15:20 -0500 )edit

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

Orchaldir gravatar image Orchaldir  ( 2016-04-22 06:25:28 -0500 )edit

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

Martin Günther gravatar image Martin Günther  ( 2016-04-22 06:57:09 -0500 )edit

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!

Jasmin gravatar image Jasmin  ( 2017-10-13 03:29:43 -0500 )edit
tfoote gravatar image tfoote  ( 2017-11-30 13:18:41 -0500 )edit