SpringBoot + Mybatis 显示sql的配置方式

加入log4j.properties

#logger level
log4j.rootCategory=DEBUG,stdout,DebugAppender,InfoAppender,ErrorAppender  
log4j.debug=true  
log4j.appender.stdout=org.apache.log4j.ConsoleAppender    
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout       
log4j.appender.stdout.layout.ConversionPattern=[QC] %p [%t] %C.%M(%L) | %m%n  
#logger input file
log4j.logger.DebugAppender.access=DEBUG  
log4j.appender.DebugAppender=org.apache.log4j.DailyRollingFileAppender       
log4j.appender.DebugAppender.File=../logs/a.log  
log4j.appender.DebugAppender.layout=org.apache.log4j.PatternLayout       
log4j.appender.DebugAppender.layout.ConversionPattern=%d-[TS] %p %t %c - %m%n       

#logger input file
log4j.logger.InfoAppender.access=INFO  
log4j.appender.InfoAppender=org.apache.log4j.DailyRollingFileAppender       
log4j.appender.InfoAppender.File=../logs/b.log  
log4j.appender.InfoAppender.layout=org.apache.log4j.PatternLayout       
log4j.appender.InfoAppender.layout.ConversionPattern=%d-[TS] %p %t %c - %m%n       

#error log input file
log4j.logger.ErrorAppender.access=ERROR  
log4j.appender.ErrorAppender=org.apache.log4j.DailyRollingFileAppender  
log4j.appender.ErrorAppender.File=../logs/c.log  
log4j.appender.ErrorAppender.Append = true  
log4j.appender.ErrorAppender.threshold = ERROR  
log4j.appender.ErrorAppender.layout=org.apache.log4j.PatternLayout   
log4j.appender.ErrorAppender.layout.ConversionPattern=%d{MM-dd HH:mm:ss.SSS} %c %-5p - %m%n  

application.yml(根据项目自行定义)中加入


logging:
  level:
    net:
      chinacloud:
        smartwater:
          mapper: DEBUG

即可

你可能感兴趣的:(备忘)