How to use log4j+slf4j for OpenIDM instead JUL

151 Views Asked by At

Configure Server Logs is what I am reading to see how I can configure server logs for Forgerock OpenIDM. I could not see anything in this document which mentions how we can use any other logging framework than JUL.

Can we really use any other logging framework with Forgerock OpenIDM? Please guide.

1

There are 1 best solutions below

1
David Tonhofer On

I am not knowledgeable with that particular system, but if it logs to java.util.logging instead of the SLF4J API, replacing the logging subsystem may not be possible, as the program has to explicitly load a new handler - it cannot be done at configuration time.

See for example:

JUL to SLF4J Bridge

A commenter writes:

You need to call SLF4JBridgeHandler.install(). You also need to enable all log levels at the root logger (reason in excerpt below) in java.util.logging and remove the default console appender.

...

The reason is that the jul-to-slf4j bridge cannot replace classes in the java.util.logging package to do the redirection statically as it does for the other bridge implementations. Instead it has to register a handler on the root logger and listen for logging statements like any other handler. It will then redirect those logging statements