Set root logging level in application.yml

后端 未结 4 1698
旧时难觅i
旧时难觅i 2021-01-30 12:51

I used an application.properties with Spring Boot (1.3 M1) and started to translate it into a yaml file because it grew more and more complex.

But I have problems transl

相关标签:
4条回答
  • 2021-01-30 12:54

    If you want level by package, you can use this syntax :

    logging:
      level:
         org.springframework.web: DEBUG
         guru.springframework.controllers: DEBUG
         org.hibernate: DEBUG
         org: INFO
    
    0 讨论(0)
  • 2021-01-30 12:59

    You can use ROOT to configure the root logging level:

    logging:
      level:
        ROOT: DEBUG
    
    0 讨论(0)
  • 2021-01-30 13:08

    It's an old question, but I just had this problem.

    While setting

    org.springframework.web: debug
    

    or

    org.hibernate: debug
    

    works fine, if you want to do the same for your project files (setting level per package), you have to use wildcards. So, for the example in the question, it would be:

    logging:
        level:
            root: WARN
            com.filenet.wcm.*: ERROR
            de.mycompany.*: DEBUG
    

    Alternatively, you can set the logging level per class without using wildcards, as shown in torina's answer.

    0 讨论(0)
  • 2021-01-30 13:17

    You can even use your classname to configure logging level:

    logging:
      level:
        com.yourorganization.Yourclass: DEBUG
    
    0 讨论(0)
提交回复
热议问题