Authored by chenchao

split logger

... ... @@ -24,6 +24,7 @@ import com.yohoufo.order.service.cache.CacheCleaner;
import com.yohoufo.order.service.cache.CacheKeyBuilder;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -38,7 +39,7 @@ import java.util.Objects;
public class SellerOrderPaymentService extends AbstractOrderPaymentService {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerUtils.getSellerOrderLogger();
@Autowired
SellerOrderMapper sellerOrderMapper;
... ...
... ... @@ -6,6 +6,7 @@ import com.yohoufo.order.event.SellerCancelDeliverEvent;
import com.yohoufo.order.mq.DelayTime;
import com.yohoufo.order.mq.TopicConstants;
import com.yohoufo.order.mq.producer.TradeMqSender;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -17,7 +18,7 @@ import org.springframework.stereotype.Component;
@Component
public class SellerCancelDeliverHandler implements IEventHandler<SellerCancelDeliverEvent> {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerUtils.getSellerOrderLogger();
public static final int DELAY_MINUTES_36_HOURS = DelayTime.MINUTES_36_HOURS;
@Autowired
... ...
... ... @@ -5,6 +5,7 @@ import com.yohoufo.order.model.dto.EarnestMoney;
import com.yohoufo.order.model.dto.PlatformFeeDto;
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
import com.yohoufo.order.model.dto.ServiceFeeRate;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
... ... @@ -19,7 +20,7 @@ import java.math.BigDecimal;
@Component
public class SellerOrderComputeHandler {
private Logger logger = LoggerFactory.getLogger(getClass());
private Logger logger = LoggerUtils.getSellerOrderLogger();
@Value("${order.seller.earnestmoney.min:28}")
private double earnestmoney_min;
... ...
... ... @@ -14,8 +14,10 @@ import com.yohoufo.order.service.impl.SkupService;
import com.yohoufo.order.service.impl.SellerAddressService;
import com.yohoufo.order.service.impl.SellerFeeService;
import com.yohoufo.order.service.impl.SellerOrderCreateService;
import com.yohoufo.order.utils.LoggerUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
... ... @@ -30,9 +32,8 @@ import java.util.stream.Collectors;
* Created by chenchao on 2018/9/17.
*/
@Service
@Slf4j
public class SellerOrderSubmitHandler {
private final Logger log = LoggerUtils.getSellerOrderLogger();
@Autowired
private SellerOrderCreateService sellerOrderCreateService;
... ...
... ... @@ -17,6 +17,7 @@ import com.yohoufo.order.model.dto.EarnestMoney;
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
import com.yohoufo.order.model.dto.ServiceFeeRate;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -37,7 +38,7 @@ import java.util.Set;
public class SellerFeeService {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerUtils.getSellerOrderLogger();
@Autowired
private SellerOrderMetaMapper somMapper;
... ...
... ... @@ -10,6 +10,7 @@ import com.yohoufo.order.common.DelStatus;
import com.yohoufo.order.common.Payment;
import com.yohoufo.order.model.SellerOrderContext;
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -25,7 +26,7 @@ import java.util.List;
*/
@Service
public class SellerOrderCreateService {
private Logger logger = LoggerFactory.getLogger(getClass());
private Logger logger = LoggerUtils.getSellerOrderLogger();
@Autowired
private SellerOrderMapper sellerOrderMapper;
... ...
... ... @@ -31,6 +31,7 @@ import com.yohoufo.order.service.proxy.UserProxyService;
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
... ... @@ -49,7 +50,7 @@ import java.util.Objects;
@Service
public class SellerOrderDetailService extends AbsOrderDetailService implements IOrderDetailService,AbsSellerOrderViewService {
final Logger logger = LoggerFactory.getLogger(getClass());
final Logger logger = LoggerUtils.getSellerOrderLogger();
@Autowired
private SellerOrderMapper sellerOrderMapper;
... ...
... ... @@ -60,6 +60,7 @@ import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.PaymentHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
... ... @@ -82,7 +83,7 @@ import java.util.stream.Collectors;
@Service
public class SellerOrderService implements IOrderListService, IOrderDetailService {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger log = LoggerUtils.getSellerOrderLogger();
@Autowired
private SellerOrderMapper sellerOrderMapper;
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.order.service.impl;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.SkupBatchMapper;
import com.yohoufo.dal.order.model.SkupBatch;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -14,7 +15,7 @@ import org.springframework.stereotype.Service;
@Service
public class SkupBatchService {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerUtils.getSellerOrderLogger();
@Autowired
private SkupBatchMapper skupBatchMapper;
... ...
... ... @@ -8,6 +8,7 @@ import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohobuy.ufo.model.order.bo.GoodsInfo;
import com.yohoufo.order.convert.GoodsInfoConvertor;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -24,7 +25,7 @@ import java.util.List;
public class SkupService {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerUtils.getSellerOrderLogger();
@Autowired
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
... ...
... ... @@ -20,6 +20,7 @@ import com.yohoufo.order.model.dto.SellerOrderComputeResult;
import com.yohoufo.order.model.dto.SkupDto;
import com.yohoufo.order.service.handler.SellerOrderComputeHandler;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
... ... @@ -37,7 +38,7 @@ import java.util.stream.Collectors;
@Service
public class ChangePricePrepareProcessor {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerUtils.getSellerOrderLogger();
@Autowired
private BuyerOrderGoodsMapper buyerOrderGoodsMapper;
... ...
... ... @@ -4,6 +4,7 @@ import com.yohobuy.ufo.model.order.req.SellerOrderComputeReq;
import com.yohoufo.common.exception.GatewayException;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.common.utils.BigDecimalHelper;
import com.yohoufo.order.utils.LoggerUtils;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
... ... @@ -18,7 +19,7 @@ import java.math.BigDecimal;
@Service
public class PriceComputePrepareProcessor {
final Logger log = LoggerFactory.getLogger(getClass());
final Logger log = LoggerUtils.getSellerOrderLogger();
@Data
public static class PriceComputeNode{
int uid;
... ...
... ... @@ -7,6 +7,7 @@ import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.order.model.dto.SkupDto;
import com.yohoufo.order.utils.LoggerUtils;
import lombok.Data;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
... ... @@ -26,7 +27,7 @@ import java.util.stream.Collectors;
@Service
public class SellerBatchCancelPrepareProcessor {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerUtils.getSellerOrderLogger();
@Autowired
private SellerOrderPrepareProcessor sellerOrderPrepareProcessor;
... ...
... ... @@ -18,9 +18,9 @@ import com.yohoufo.order.service.handler.SellerOrderComputeHandler;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.service.proxy.UserProxyService;
import com.yohoufo.order.utils.AddressHelper;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.product.model.GoodsSize;
import com.yohoufo.product.response.StorageDataResp;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -35,7 +35,7 @@ import java.util.Objects;
@Service
public class SellerOrderPrepareProcessor {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger log = LoggerUtils.getSellerOrderLogger();
@Autowired
private UserProxyService userProxyService;
... ...
... ... @@ -6,6 +6,7 @@ import com.yohobuy.ufo.model.order.common.CancelType;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohoufo.order.event.OrderCancelEvent;
import com.yohoufo.order.service.impl.SellerOrderCancelService;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -19,7 +20,7 @@ import java.util.Objects;
@Service
public class SellerOrderCancelHandler implements IEventHandler<OrderCancelEvent> {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerUtils.getOrderCloseLogger();
@Autowired
private SellerOrderCancelService sellerOrderCancelService;
... ...
... ... @@ -9,18 +9,26 @@ import org.slf4j.LoggerFactory;
public class LoggerUtils {
public static Logger getMqConsumerLogger() {
return LoggerFactory.getLogger("mqConsumerLog");
return buildByName("mqConsumerLog");
}
public static Logger getOrderCloseLogger() {
return LoggerFactory.getLogger("orderCloseLog");
return buildByName("orderCloseLog");
}
public static Logger getMqProducerLogger() {
return LoggerFactory.getLogger("mqProducerLog");
return buildByName("mqProducerLog");
}
public static Logger getPayConfirmLogger(){
return LoggerFactory.getLogger("payConfirmLog");
return buildByName("payConfirmLog");
}
public static Logger getSellerOrderLogger(){
return buildByName("sellerOrderLog");
}
static Logger buildByName(String logName){
return LoggerFactory.getLogger(logName);
}
}
... ...
... ... @@ -174,6 +174,23 @@
</encoder>
</appender>
<appender name="SELLER_ORDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/seller-order.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 按天回滚 daily -->
<fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/seller-order.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>${yoho.logs.maxHistory}</maxHistory>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
</encoder>
</appender>
<logger name="org.apache.zookeeper.ClientCnxn" level="WARN" />
<!-- 登录时,如果一个IP在一定时间内登录次数过多,记录日志 appender -->
<logger name="ipLoginMoreLog" level="INFO" additivity="false">
... ... @@ -241,5 +258,9 @@
<logger name="mqProducerLog" level="INFO" additivity="false">
<appender-ref ref="MQ_PRODUCER" />
</logger>
<logger name="sellerOrderLog" level="INFO" additivity="false">
<appender-ref ref="SELLER_ORDER" />
</logger>
</configuration>
\ No newline at end of file
... ...
... ... @@ -476,6 +476,22 @@
</encoder>
</appender>
<appender name="SELLER_ORDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/seller-order.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 按天回滚 daily -->
<fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/seller-order.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>${yoho.logs.maxHistory}</maxHistory>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
</encoder>
</appender>
<!-- 数据库操作日志 -->
<logger name="java.sql.PreparedStatement" value="${yoho.logs.level}"/>
<logger name="java.sql.Connection" value="${yoho.logs.level}"/>
... ... @@ -590,4 +606,8 @@
<logger name="mqProducerLog" level="INFO" additivity="false">
<appender-ref ref="MQ_PRODUCER" />
</logger>
<logger name="sellerOrderLog" level="INFO" additivity="false">
<appender-ref ref="SELLER_ORDER" />
</logger>
</configuration>
... ...