Reputation: 1571
My use case is as follows. I'm developing a large spring based application and we are using spring boot logging throughout. However, for various reasons I need to use a third-party library that uses java.util.Logger in its internals. This causes the two separate loggers to both send their output to our console.
I've found many examples on how to configure spring boot logging to use java logging as its output, but I haven't been able to determine how to go the other way.
The library in question - JLibModbus - includes API access to set it's logging level or to turn it off, but I don't see any way to actually tell it to use a different logger. Presumably this should be possible. I'm hoping that someone else has already done this.
(Actually I'm working in Kotlin, not Java, but any answer that works in one I should be able to convert to the other.)
Upvotes: 2
Views: 1675
Reputation: 2542
If I understand you correctly, you want to configure the logging of a lib which uses Java Util Logging.
Spring Boot comes already with a managed dependency which helps you to fix your issue.
Please add or verify that you've already added the JUL to SLF4J bridge:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>
Please check also, that you put your logger configurations in the correct config file, especially referencing:
Upvotes: 3