> I believe this approach simply redirects
> JSR 47 logging into our log4j log and we write all our stuff into our logs
> too. That may not be ideal, nor may it be the reality. I'll get back...
> 
> Sean
> 

Yep. That's what we do. It looks like this in the application file:

java.util.logging.Logger.getLogger("").addHandler(new 
JdkLoggingToLog4jBridge());

And JdkLoggingToLog4jBridge.publlish() just gets the appropriate log4j 
logger with:

Logger logger = Logger.getLogger(record.getLoggerName());

and checks the level and calls the appropriate log4j logger method like:

logger.debug(record.getMessage(), record.getThrown());


This is probably easier than the other 3 options at the expense of writing to 
an additional handler from the JSR 47 side. That's not so bad since the JSR-47
logger isn't very noisy at the default level. 

One downside is that there's two different ways to adjust the log levels for 
the respective loggers. This isn't bad for an application developer though
since they are probably going to be concerned with their app and not Restlet 
logging. 

Sean

Reply via email to