Spring-Boot logging with log4j2?

后端 未结 3 1660
挽巷
挽巷 2021-02-07 08:26

I\'m using spring-boot-starter, and would like to configure log4j2.xml to log asynchron + different content to different logfiles.

I created th

3条回答
  •  -上瘾入骨i
    2021-02-07 08:47

    I've a better way:

    1. Exclude logback logger:

      
          org.springframework.boot
          spring-boot-starter
          
              
                  org.springframework.boot
                  spring-boot-starter-logging
              
          
      
      
    2. Add log4j2 boot starter:

      
          org.springframework.boot
          spring-boot-starter-log4j2
      
      

    Source: http://docs.spring.io/spring-boot/docs/1.5.1.RELEASE/reference/htmlsingle/#howto-configure-log4j-for-logging

    Enjoy!

提交回复
热议问题