Slf4j Log selection Policy

I configured slf4j and morphia in the project

  <dependency>
            <groupId>org.mongodb.morphia</groupId>
            <artifactId>morphia</artifactId>
            <version>1.3.1</version>
        </dependency>
        <!-- slf4j -->
        <dependency>
                 <groupId>org.slf4j</groupId>
                 <artifactId>slf4j-simple</artifactId>
                 <version>1.7.5</version>
             </dependency> 

Log configuration is as follows

   private static Logger logger = LoggerFactory.getLogger(MongodbTest.class);
    /**
     * 
     */
    @Test
    public void testSlf4j(){
        logger.debug("lalalala");
        logger.warn("lalala");
        logger.info("lalala");
    }

the following is the output

 23, 2018 3:59:18  org.mongodb.morphia.logging.MorphiaLoggerFactory chooseLoggerFactory
: LoggerImplFactory set to org.mongodb.morphia.logging.jdk.JDKLoggerFactory
[main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [springconfig.xml]
[main] INFO org.springframework.context.support.GenericApplicationContext - Refreshing org.springframework.context.support.GenericApplicationContext@9597028: startup date [Mon Apr 23 15:59:19 CST 2018]; root of context hierarchy
[main] WARN shenzhen.MongodbTest - lalala
[main] INFO shenzhen.MongodbTest - lalala

Why did slf4j choose morphia logs instead of slf4j simple logs

Mar.05,2021

if you want to use slf4j's logging module, exclude the logging part when introducing org.mongodb.morphia. The reason for this phenomenon in
is that when log looks for the implementation class, it first finds the log implementation class of mongodb and instantiates it.
maven configuration reference exclusion:

<exclusions>
    <exclusion>
        <groupId> XXXXXX </groupId>
        <artifactId> XXXXXX </artifactId>
    </exclusion>
</exclusions>
Menu