0
$\begingroup$

Rosanswers logo

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.


Originally posted by moritz on ROS Answers with karma: 2673 on 2014-11-26

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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


Originally posted by Juan Antonio Breña Moral with karma: 274 on 2017-07-03

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.