I simply want to disable Restlet\'s logging to stdout/stderr in my project and forward all Restlet logging through the SLF4J facade provided by org.restlet.ext.slf4j. Is there a
This is what I did to disable the logging to STDERR and forward the logging to log4j. Basicly it's just a base class from which all restlets are based. It will install the log4j bridge, find the console handler and disable it. Works for me but might not be the best solution so if anyone has a better solution which does not require external config, please let me know.
public class CommonRestlet extends Application {
static {
// Install logging bridge (JUL -> LOG4J)
SLF4JBridgeHandler.install();
// Disable annoying console logging of requests..
Logger logger = Logger.getLogger("org.restlet");
for (Handler handler : logger.getParent().getHandlers()) {
// Find the console handler
if (handler.getClass().equals(java.util.logging.ConsoleHandler.class)) {
// set level to SEVERE. We could disable it completely with
// a custom filter but this is good enough.
handler.setLevel(Level.SEVERE);
}
}
}
// Other common stuff here...
}
Dependency in pom.xml
org.slf4j
jul-to-slf4j
1.6.1
org.slf4j
slf4j-log4j12
1.6.1
log4j
log4j