Commit 936eec0bf8c1036982e634e813cb4661f77101ea
1 parent
0d0e1c7e
去除myBatis日志 加上kafka发送成功的日志
Showing
3 changed files
with
3 additions
and
6 deletions
src/main/java/com/example/demo/service/Contrast.java
| @@ -16,8 +16,6 @@ import org.springframework.kafka.support.SendResult; | @@ -16,8 +16,6 @@ import org.springframework.kafka.support.SendResult; | ||
| 16 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
| 17 | import org.springframework.util.concurrent.ListenableFuture; | 17 | import org.springframework.util.concurrent.ListenableFuture; |
| 18 | import org.springframework.util.concurrent.ListenableFutureCallback; | 18 | import org.springframework.util.concurrent.ListenableFutureCallback; |
| 19 | - | ||
| 20 | -import javax.annotation.Resource; | ||
| 21 | import java.text.ParseException; | 19 | import java.text.ParseException; |
| 22 | import java.text.SimpleDateFormat; | 20 | import java.text.SimpleDateFormat; |
| 23 | import java.time.*; | 21 | import java.time.*; |
| @@ -319,6 +317,7 @@ public class Contrast { | @@ -319,6 +317,7 @@ public class Contrast { | ||
| 319 | future.addCallback(new ListenableFutureCallback<SendResult<String, String>>() { | 317 | future.addCallback(new ListenableFutureCallback<SendResult<String, String>>() { |
| 320 | @Override | 318 | @Override |
| 321 | public void onSuccess(SendResult<String, String> result) { | 319 | public void onSuccess(SendResult<String, String> result) { |
| 320 | + logger.info("kafka发送票务数据成功条数:"+data.size()); | ||
| 322 | } | 321 | } |
| 323 | @Override | 322 | @Override |
| 324 | public void onFailure(Throwable ex) { | 323 | public void onFailure(Throwable ex) { |
src/main/resources/application.properties
| @@ -17,7 +17,7 @@ spring.datasource.db2.druid.test-while-idle=true | @@ -17,7 +17,7 @@ spring.datasource.db2.druid.test-while-idle=true | ||
| 17 | 17 | ||
| 18 | mybatis.mapperLocations=classpath:mapping/**/*.xml | 18 | mybatis.mapperLocations=classpath:mapping/**/*.xml |
| 19 | mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl | 19 | mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl |
| 20 | -logging.level.com.example.demo.mapper=debug | 20 | +logging.level.com.example.demo.mapper=info |
| 21 | #logging.level.org.mybatis = debug | 21 | #logging.level.org.mybatis = debug |
| 22 | 22 | ||
| 23 | 23 |
src/main/resources/logback.xml
| @@ -11,9 +11,7 @@ | @@ -11,9 +11,7 @@ | ||
| 11 | <!--获取比info级别高(包括info级别)但除error级别的日志--> | 11 | <!--获取比info级别高(包括info级别)但除error级别的日志--> |
| 12 | <appender name="INFO-LOG" class="ch.qos.logback.core.rolling.RollingFileAppender"> | 12 | <appender name="INFO-LOG" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| 13 | <filter class="ch.qos.logback.classic.filter.LevelFilter"> | 13 | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| 14 | - <level>ERROR</level> | ||
| 15 | - <onMatch>DENY</onMatch> | ||
| 16 | - <onMismatch>ACCEPT</onMismatch> | 14 | + <level>INFO</level> |
| 17 | </filter> | 15 | </filter> |
| 18 | <encoder> | 16 | <encoder> |
| 19 | <pattern>[%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%C] [%t] [%L] [%-5p] %m%n</pattern> | 17 | <pattern>[%d{yyyy-MM-dd' 'HH:mm:ss.sss}] [%C] [%t] [%L] [%-5p] %m%n</pattern> |