Filtering out log4j messages from third-party frameworks?

后端 未结 4 535
粉色の甜心
粉色の甜心 2020-12-04 18:14

How do I filter log messages from external third party frameworks? I am using Hibernate and Spring framework and I would like to suppress the logs so that only my log4j logs

4条回答
  •  Happy的楠姐
    2020-12-04 18:47

    You can do it by changing logger level in log4j.properties/log4j.xml file.

    You need to set logger's if you want to filter logs from package but keep logger configuration for later use. You could also set it to highest level to log only in case of error or fatal issue.

    Following entries should be added to log4j.xml to turn off logging from hibernate and springframework packages:

    
        
    
    
        
    
    

提交回复
热议问题