views:

28

answers:

2

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 an easy way to do this?

A: 

I tend to use the jul-to-slf4j bridge, but you can get other configurations, as described on the Restlet Wiki.

Bruno
A: 

You first must configure SLF4J to intercept all of Restlet's calls to the java.util.logging APIs and map them into calls on the SLF4J facade's APIs instead. You simply do this by putting jul-to-slf4j.jar in your classpath, as @Bruno noted.

Second, you have to configure the SLF4J facade to forward its API calls on to a logging implementation to do the actual log message generation. To use the Logback logging implementation, you drop logback-classic.jar into your classpath

Finally, you have to configure your selected logging implementation. If you're using Logback, you can adjust the logging level of individual Loggers using XML.

We're using SLF4J with Restlet, and really like how SLF4J unifies all the different logging APIs into one. It's very nice.

Jim Ferrans