4

I was a happy user of restlet 2.0.15 until yesterday, when they seem to have discontinued the 2.0.x versions from their Maven repository, so I had to upgrade to 2.1.1.

In the old version I was using SLF4J as a bridge to Log4J and I was able to get the restlet logs to my Log4J based logging system. This is no longer working with restlet 2.1.1. Any ideas what I would need to fix?

This is the way it was working:

public static void initLogging() {
    // install the SL4J bridge such as the org.restlet logging messages to
    // be appended to Log4J too, from the default java.util.logging based
    // implementation
    SLF4JBridgeHandler.install();
    ...
    if (log4j != null) {
        DOMConfigurator.configure(log4j);
    }
    log = Logger.getLogger(SomeClass.class);
}
Dan D.
  • 32,246
  • 5
  • 63
  • 79

2 Answers2

3

We encountered a hardware failure this week-end and will be progressively restoring the 2.0.x artifacts in our Maven repository (versions up to 2.0.10 are already available).

However, the 2.0 branch has reached its end of life so upgrading to 2.1.1 is definitely a good idea.

To my knowledge the SLF4J extension hasn't changed at all since 2.0, only log levels were adjusted and programmatic control of JULI was added. It might have broken something.

Could you enter an issue in GitHub?

Jerome Louvel
  • 2,882
  • 18
  • 19
  • Thanks. I entered issue #706. – Dan D. Jan 16 '13 at 11:05
  • 2
    I discovered that it works fine with the slf4j restlet extension and with this line: System.setProperty("org.restlet.engine.loggerFacadeClass", "org.restlet.ext.slf4j.Slf4jLoggerFacade"); instead of SLF4JBridgeHandler.install(); – Dan D. Jan 24 '13 at 19:16
1

I discovered that it works fine with the slf4j restlet extension and with this line:

System.setProperty("org.restlet.engine.loggerFacadeClass", "org.restlet.ext.slf4j.Slf4jLoggerFacade"); 

instead of

SLF4JBridgeHandler.install(); 
Dan D.
  • 32,246
  • 5
  • 63
  • 79
  • See also [here for getting rid of console stderr logging](http://stackoverflow.com/questions/3596676/how-can-i-disable-logging-in-restlet-2-0) – Carl Pritchett Mar 12 '13 at 06:30
  • Actually I found setting this using a -D start-up property rather than using System.setProperty() eliminates all the STDERR logging. Why a library logs info to STDERR I'm not sure - seems wrong to me. – Carl Pritchett Mar 12 '13 at 23:54