Authored by liangyi.chen@yoho.cn

sql日志优化

... ... @@ -42,7 +42,7 @@ public class UserFavoriteArticleListener extends AbstractMqListener<UserFavorite
// #{user_favorite_article.article_id} and article_type in (1,2,4);
publicUserFavorite.setTargetId((Integer) checkResult);
publicUserFavorite.setSrcChannel(ServiceConstant.SRCCHANNEL_TYPE.YOHO_GRASS);
publicUserFavoriteService.deletePublicUserPraise(publicUserFavorite);
publicUserFavoriteService.deletePublicUserFavorite(publicUserFavorite);
}
@Override
... ... @@ -58,7 +58,7 @@ public class UserFavoriteArticleListener extends AbstractMqListener<UserFavorite
publicUserFavorite.setTargetId((Integer) checkResult);
publicUserFavorite.setFavoriteType(ServiceConstant.Public_User_Favorite.FAVORITE_TYPE_ARTICLE);
publicUserFavorite.setSrcChannel(ServiceConstant.SRCCHANNEL_TYPE.YOHO_GRASS);
publicUserFavoriteService.saveOrUpdatePublicUserPraise(publicUserFavorite);
publicUserFavoriteService.saveOrUpdatePublicUserFavorite(publicUserFavorite);
}
... ...
... ... @@ -38,7 +38,7 @@ public class PublicUserCommentService {
}else{
logger.error("数据不存在relateId={},srcChannel={}", publicUserComment.getRelateId() ,
publicUserComment.getSrcChannel());
throw new Exception();
throw new Exception("deletePublicUserComment数据不存在");
}
}
... ...
... ... @@ -18,7 +18,7 @@ public class PublicUserFavoriteService {
private static final Logger logger = LoggerFactory.getLogger(PublicUserFavoriteService.class);
public void saveOrUpdatePublicUserPraise(PublicUserFavorite publicUserFavorite)throws Exception {
public void saveOrUpdatePublicUserFavorite(PublicUserFavorite publicUserFavorite)throws Exception {
PublicUserFavorite publicUserFavoriteFromDB = getPublicUserFavoriteByUniqueKey(publicUserFavorite);
if (publicUserFavoriteFromDB != null) { //更新
BeanCopyUtils.copyNonNullProperties(publicUserFavorite , publicUserFavoriteFromDB , PublicUserFavorite.class);
... ... @@ -28,14 +28,14 @@ public class PublicUserFavoriteService {
}
}
public void deletePublicUserPraise(PublicUserFavorite publicUserFavorite) throws Exception{
public void deletePublicUserFavorite(PublicUserFavorite publicUserFavorite) throws Exception{
PublicUserFavorite publicUserFavoriteFromDB = getPublicUserFavoriteByUniqueKey(publicUserFavorite);
if (publicUserFavoriteFromDB != null) {
repository.deleteById(publicUserFavoriteFromDB.getId());
}else{
logger.error("参数不合法srcChannel={},uid={},targetId={}", publicUserFavorite.getSrcChannel(),
publicUserFavorite.getUid(),publicUserFavorite.getTargetId());
throw new Exception();
throw new Exception("deletePublicUserFavorite数据不存在");
}
}
... ...
... ... @@ -12,3 +12,6 @@ spring:
username: yh_test
password: 9nm0icOwt6bMHjMusIfMLw==
driver-class-name: com.mysql.jdbc.Driver
logging:
config: classpath:logback-boot.xml
... ...
... ... @@ -8,7 +8,7 @@ rabbitmq:
spring:
datasource:
url: jdbc:mysql://read.cms.yohoops.org:3306/yh_pcms?useUnicode=true&amp;characterEncoding=UTF-8
url: jdbc:mysql://write.pcms.yohoops.org:3306/yh_pcms?useUnicode=true&amp;characterEncoding=UTF-8
username: yh_vpc_bak
password: +BfhVxZQ4LuPKt+QxSy9naMwEu/zaKV31I9S8xDJIUA=
driver-class-name: com.mysql.jdbc.Driver
... ...
spring:
profiles:
active: dev
jpa:
properties:
hibernate:
show_sql: true
server:
port: 8080
... ... @@ -9,3 +13,4 @@ management:
health:
rabbit:
enabled: false
... ...
... ... @@ -120,10 +120,14 @@
<!-- 数据检测相关日志 -->
<logger name="DATA_CHECKERROR" additivity="false">
<level value="INFO"/>
<level value="WARN"/>
<appender-ref ref="DATA_CHECKERROR_LOG"/>
</logger>
<!-- sql打印日志 -->
<logger name="org.hibernate.SQL" level="DEBUG"/>
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG"/>
<!-- root级别 DEBUG -->
<root level="INFO">
<!-- 控制台输出 -->
... ...