ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Set log levels in rosjava nodes

asked 2014-11-26 06:52:59 -0600

moritz gravatar image

How can I set the default log level of rosjava nodes to something below INFO?

The Apache Commons 'Log' interface does not support this, but delegates the configuration to the underlying logging mechanism. I have tried putting the usual log4j.properties files into the root of my catkin package or into the rosjava subprojects contained therein, but that did not have any effect. My application calls rosjava from a Prolog shell that currently gets clogged with log messages at the INFO level, so I'd be happy about any hints.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2017-07-03 04:25:30 -0600

To set the logs, create a file like this one:

log-config.properties

# The following creates two handlers
handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler
# Set the default logging level for the root logger
.level=ALL
# log level for the "com.example" package
org.ros.logging.level=ALL
# Set the default logging level
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.FileHandler.level=ALL
# Set the default formatter
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
# Specify the location and name of the log file
java.util.logging.FileHandler.pattern=/home/robot/test.log

later, in the execution:

java -Djava.util.logging.config.file=/home/robot/log-config.properties -jar rosjava-helloworld-0.1.0-SNAPSHOT-all.jar

Juan Antonio

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-11-26 06:52:59 -0600

Seen: 315 times

Last updated: Jul 03 '17