exclude Log4j print Log

JennieRainbow發表於2024-06-06
//dependency
      <dependency>
         <groupId>ch.qos.logback</groupId>
         <artifactId>logback-core</artifactId>
         <version>1.2.13</version>
      </dependency>
      <dependency>
         <groupId>ch.qos.logback</groupId>
         <artifactId>logback-classic</artifactId>
         <version>1.2.13</version>
         <exclusions>
            <exclusion>
               <groupId>ch.qos.logback</groupId>
               <artifactId>logback-core</artifactId>
            </exclusion>
         </exclusions>
      </dependency>

      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-api</artifactId>
         <version>2.0.12</version>
      </dependency>
      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-simple</artifactId>
         <version>2.0.12</version>
      </dependency>
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@EnableTransactionManagement
@SpringBootApplication
public class RavenRestApi implements ApplicationRunner {
    private static final Logger logger = LoggerFactory.getLogger(RavenRestApi.class);

    public static void main(final String[] args) {
        logger.info("ravencr-dm-backend service is starting...");

        SpringApplication.run(RavenRestApi.class, args);
    }

    @Override
    public void run(ApplicationArguments args) {
        logger.info("ravencr-dm-backend is running");
    }

}

相關文章