Spring External Jar Boot Kit Layer using Java Util Logging (jul)

According to the Spring Boot documentation, it is possible to set the logging level of multiple logging frameworks (jul, slf4j, etc.) only by using the Spring Boot Logging Starter and setting the appropriate logging.level parameter in the application property. Everything works fine except that the library I'm using logs with jul and log level Level.FINER. However, Level.INFO is registered correctly.

I have set the level in application.properties for:

logging.level.=TRACE

      

which should register everything according to SLF4JBridgeHandler .

Am I missing something or is this a logback problem (used by the starter) and not my misunderstanding?

+3


source to share


2 answers


See my answer: fooobar.com/questions/2157671 / ...



In short, use Spring Boot 1.3.0 with a log.

+1


source


SLF4JBridgeHandler only gets LogRecord from allowed levels on jul Loggers (this fact is hidden in the javadoc of the install method )

Since the standard JUL configuration only registers INFO or higher, the bridge does not receive FINE / FINER / FINEST levels.

To check , you can force the root error logger level like this:

LogManager.getLogManager().getLogger("").setLevel(Level.FINE);

      



(or configure explicitly custom logging options with .level = FINE on your JVM)

This config needs to be populated with slf4j level config (via logback.xml or logging.level.xxxxxx properties in application.properties)

(Note that you have to be more specific in your jul production config as slf4j documentation warns about performance impact "jul enabled" but "slf4j disabled")

0


source







All Articles