Authored by wujiexiang

新增日志文件

@@ -16,9 +16,9 @@ import com.yohoufo.order.model.response.OrderDetailInfo; @@ -16,9 +16,9 @@ import com.yohoufo.order.model.response.OrderDetailInfo;
16 import com.yohoufo.order.service.IBuyerOrderService; 16 import com.yohoufo.order.service.IBuyerOrderService;
17 import com.yohoufo.order.service.impl.SellerFeeService; 17 import com.yohoufo.order.service.impl.SellerFeeService;
18 import com.yohoufo.order.service.impl.SellerOrderService; 18 import com.yohoufo.order.service.impl.SellerOrderService;
  19 +import com.yohoufo.order.utils.LoggerUtils;
19 import org.apache.commons.lang3.StringUtils; 20 import org.apache.commons.lang3.StringUtils;
20 import org.slf4j.Logger; 21 import org.slf4j.Logger;
21 -import org.slf4j.LoggerFactory;  
22 import org.springframework.beans.factory.annotation.Autowired; 22 import org.springframework.beans.factory.annotation.Autowired;
23 import org.springframework.web.bind.annotation.*; 23 import org.springframework.web.bind.annotation.*;
24 24
@@ -26,7 +26,7 @@ import java.util.Objects; @@ -26,7 +26,7 @@ import java.util.Objects;
26 26
27 @RestController 27 @RestController
28 public class BuyerOrderController { 28 public class BuyerOrderController {
29 - private final Logger LOG = LoggerFactory.getLogger(BuyerOrderController.class); 29 + private final Logger LOG = LoggerUtils.getBuyerOrderLogger();
30 30
31 @Autowired 31 @Autowired
32 IBuyerOrderService buyerOrderService; 32 IBuyerOrderService buyerOrderService;
@@ -3,14 +3,12 @@ package com.yohoufo.order.controller; @@ -3,14 +3,12 @@ package com.yohoufo.order.controller;
3 import com.yoho.core.rest.annotation.ServiceDesc; 3 import com.yoho.core.rest.annotation.ServiceDesc;
4 import com.yoho.tools.common.beans.ApiResponse; 4 import com.yoho.tools.common.beans.ApiResponse;
5 import com.yohobuy.ufo.model.order.req.BuyerOrderMetaUpdateReq; 5 import com.yohobuy.ufo.model.order.req.BuyerOrderMetaUpdateReq;
6 -import com.yohobuy.ufo.model.user.req.AuthorizeInfoReq;  
7 import com.yohoufo.common.annotation.IgnoreSession; 6 import com.yohoufo.common.annotation.IgnoreSession;
8 import com.yohoufo.common.annotation.IgnoreSignature; 7 import com.yohoufo.common.annotation.IgnoreSignature;
9 -import com.yohoufo.dal.user.model.UserAuthorizeInfo;  
10 import com.yohoufo.order.service.IBuyerOrderMetaService; 8 import com.yohoufo.order.service.IBuyerOrderMetaService;
  9 +import com.yohoufo.order.utils.LoggerUtils;
11 import org.apache.commons.lang3.StringUtils; 10 import org.apache.commons.lang3.StringUtils;
12 import org.slf4j.Logger; 11 import org.slf4j.Logger;
13 -import org.slf4j.LoggerFactory;  
14 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.web.bind.annotation.RequestBody; 13 import org.springframework.web.bind.annotation.RequestBody;
16 import org.springframework.web.bind.annotation.RequestMapping; 14 import org.springframework.web.bind.annotation.RequestMapping;
@@ -20,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController; @@ -20,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
20 @RequestMapping(value="/order/buyerOrderMeta") 18 @RequestMapping(value="/order/buyerOrderMeta")
21 @ServiceDesc("orderBuyerOrderMeta") 19 @ServiceDesc("orderBuyerOrderMeta")
22 public class BuyerOrderMeta4PlatformController { 20 public class BuyerOrderMeta4PlatformController {
23 - private final Logger logger = LoggerFactory.getLogger(BuyerOrderMeta4PlatformController.class); 21 + private final Logger logger = LoggerUtils.getBuyerOrderLogger();
24 22
25 @Autowired 23 @Autowired
26 private IBuyerOrderMetaService buyerOrderMetaService; 24 private IBuyerOrderMetaService buyerOrderMetaService;
@@ -8,9 +8,9 @@ import com.yohoufo.order.service.IBuyerOrderService; @@ -8,9 +8,9 @@ import com.yohoufo.order.service.IBuyerOrderService;
8 import com.yohoufo.order.service.IShoppingService; 8 import com.yohoufo.order.service.IShoppingService;
9 import com.yohoufo.order.service.impl.SellerOrderService; 9 import com.yohoufo.order.service.impl.SellerOrderService;
10 import com.yohoufo.order.utils.CouponCodeUtils; 10 import com.yohoufo.order.utils.CouponCodeUtils;
  11 +import com.yohoufo.order.utils.LoggerUtils;
11 import org.apache.commons.lang3.StringUtils; 12 import org.apache.commons.lang3.StringUtils;
12 import org.slf4j.Logger; 13 import org.slf4j.Logger;
13 -import org.slf4j.LoggerFactory;  
14 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.web.bind.annotation.*; 15 import org.springframework.web.bind.annotation.*;
16 16
@@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.*; @@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.*;
19 public class ShoppingController { 19 public class ShoppingController {
20 20
21 21
22 - private Logger logger = LoggerFactory.getLogger(getClass()); 22 + private Logger logger = LoggerUtils.getBuyerOrderLogger();
23 23
24 @Autowired 24 @Autowired
25 IShoppingService buyerOrderService; 25 IShoppingService buyerOrderService;
@@ -16,9 +16,9 @@ import com.yohoufo.order.model.request.OrderListRequest; @@ -16,9 +16,9 @@ import com.yohoufo.order.model.request.OrderListRequest;
16 import com.yohoufo.order.service.AbsBuyerOrderViewService; 16 import com.yohoufo.order.service.AbsBuyerOrderViewService;
17 import com.yohoufo.order.service.IBuyerOrderMetaService; 17 import com.yohoufo.order.service.IBuyerOrderMetaService;
18 import com.yohoufo.order.service.IOrderListService; 18 import com.yohoufo.order.service.IOrderListService;
  19 +import com.yohoufo.order.utils.LoggerUtils;
19 import org.apache.commons.collections.CollectionUtils; 20 import org.apache.commons.collections.CollectionUtils;
20 import org.slf4j.Logger; 21 import org.slf4j.Logger;
21 -import org.slf4j.LoggerFactory;  
22 import org.springframework.beans.factory.annotation.Autowired; 22 import org.springframework.beans.factory.annotation.Autowired;
23 import org.springframework.stereotype.Service; 23 import org.springframework.stereotype.Service;
24 24
@@ -30,7 +30,7 @@ import java.util.List; @@ -30,7 +30,7 @@ import java.util.List;
30 @Service 30 @Service
31 public class BuyerOrderListServiceImpl extends AbsOrderListService implements IOrderListService,AbsBuyerOrderViewService { 31 public class BuyerOrderListServiceImpl extends AbsOrderListService implements IOrderListService,AbsBuyerOrderViewService {
32 32
33 - private final Logger logger = LoggerFactory.getLogger(getClass()); 33 + private final Logger logger = LoggerUtils.getBuyerOrderLogger();
34 34
35 @Autowired 35 @Autowired
36 BuyerOrderMapper buyerOrderMapper; 36 BuyerOrderMapper buyerOrderMapper;
@@ -13,9 +13,9 @@ import com.yohobuy.ufo.model.order.vo.AddressInfo; @@ -13,9 +13,9 @@ import com.yohobuy.ufo.model.order.vo.AddressInfo;
13 import com.yohoufo.order.service.IBuyerOrderMetaService; 13 import com.yohoufo.order.service.IBuyerOrderMetaService;
14 import com.yohoufo.order.service.cache.CacheCleaner; 14 import com.yohoufo.order.service.cache.CacheCleaner;
15 import com.yohoufo.order.service.cache.CacheKeyBuilder; 15 import com.yohoufo.order.service.cache.CacheKeyBuilder;
  16 +import com.yohoufo.order.utils.LoggerUtils;
16 import org.apache.commons.lang3.StringUtils; 17 import org.apache.commons.lang3.StringUtils;
17 import org.slf4j.Logger; 18 import org.slf4j.Logger;
18 -import org.slf4j.LoggerFactory;  
19 import org.springframework.beans.factory.annotation.Autowired; 19 import org.springframework.beans.factory.annotation.Autowired;
20 import org.springframework.stereotype.Service; 20 import org.springframework.stereotype.Service;
21 21
@@ -24,7 +24,7 @@ import java.util.Arrays; @@ -24,7 +24,7 @@ import java.util.Arrays;
24 @Service 24 @Service
25 public class BuyerOrderMetaServiceImpl implements IBuyerOrderMetaService { 25 public class BuyerOrderMetaServiceImpl implements IBuyerOrderMetaService {
26 26
27 - private final static Logger logger = LoggerFactory.getLogger(BuyerOrderMetaServiceImpl.class); 27 + private final static Logger logger = LoggerUtils.getBuyerOrderLogger();
28 28
29 @Autowired 29 @Autowired
30 private BuyerOrderMetaMapper buyerOrderMetaMapper; 30 private BuyerOrderMetaMapper buyerOrderMetaMapper;
@@ -38,9 +38,9 @@ import com.yohoufo.order.service.cache.CacheKeyBuilder; @@ -38,9 +38,9 @@ import com.yohoufo.order.service.cache.CacheKeyBuilder;
38 import com.yohoufo.order.service.cache.OrderCacheService; 38 import com.yohoufo.order.service.cache.OrderCacheService;
39 import com.yohoufo.order.service.proxy.InBoxFacade; 39 import com.yohoufo.order.service.proxy.InBoxFacade;
40 import com.yohoufo.order.service.proxy.ProductProxyService; 40 import com.yohoufo.order.service.proxy.ProductProxyService;
  41 +import com.yohoufo.order.utils.LoggerUtils;
41 import org.apache.commons.lang3.StringUtils; 42 import org.apache.commons.lang3.StringUtils;
42 import org.slf4j.Logger; 43 import org.slf4j.Logger;
43 -import org.slf4j.LoggerFactory;  
44 import org.springframework.beans.factory.annotation.Autowired; 44 import org.springframework.beans.factory.annotation.Autowired;
45 import org.springframework.stereotype.Service; 45 import org.springframework.stereotype.Service;
46 46
@@ -51,7 +51,7 @@ import java.util.Objects; @@ -51,7 +51,7 @@ import java.util.Objects;
51 @Service 51 @Service
52 public class BuyerOrderServiceImpl implements IBuyerOrderService { 52 public class BuyerOrderServiceImpl implements IBuyerOrderService {
53 53
54 - private final Logger logger = LoggerFactory.getLogger(getClass()); 54 + private final Logger logger = LoggerUtils.getBuyerOrderLogger();
55 55
56 @Autowired 56 @Autowired
57 BuyerOrderMapper buyerOrderMapper; 57 BuyerOrderMapper buyerOrderMapper;
@@ -38,10 +38,10 @@ import com.yohoufo.order.service.support.CouponSupport; @@ -38,10 +38,10 @@ import com.yohoufo.order.service.support.CouponSupport;
38 import com.yohoufo.order.service.support.ShoppingSupport; 38 import com.yohoufo.order.service.support.ShoppingSupport;
39 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; 39 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
40 import com.yohoufo.order.utils.AddressHelper; 40 import com.yohoufo.order.utils.AddressHelper;
  41 +import com.yohoufo.order.utils.LoggerUtils;
41 import com.yohoufo.order.utils.MathUtils; 42 import com.yohoufo.order.utils.MathUtils;
42 import org.apache.commons.lang3.StringUtils; 43 import org.apache.commons.lang3.StringUtils;
43 import org.slf4j.Logger; 44 import org.slf4j.Logger;
44 -import org.slf4j.LoggerFactory;  
45 import org.springframework.beans.factory.annotation.Autowired; 45 import org.springframework.beans.factory.annotation.Autowired;
46 import java.math.BigDecimal; 46 import java.math.BigDecimal;
47 import java.util.Arrays; 47 import java.util.Arrays;
@@ -51,7 +51,7 @@ import org.springframework.stereotype.Service; @@ -51,7 +51,7 @@ import org.springframework.stereotype.Service;
51 @Service 51 @Service
52 public class ShoppingServiceImpl implements IShoppingService { 52 public class ShoppingServiceImpl implements IShoppingService {
53 53
54 - private final Logger logger = LoggerFactory.getLogger(getClass()); 54 + private final Logger logger = LoggerUtils.getBuyerOrderLogger();
55 55
56 @Autowired 56 @Autowired
57 ShoppingSupport shoppingSupport; 57 ShoppingSupport shoppingSupport;
@@ -20,8 +20,8 @@ import com.yohoufo.order.model.dto.OrderBuilder; @@ -20,8 +20,8 @@ import com.yohoufo.order.model.dto.OrderBuilder;
20 import com.yohoufo.order.service.ISubmitOrderService; 20 import com.yohoufo.order.service.ISubmitOrderService;
21 import com.yohoufo.order.service.proxy.CouponProxyService; 21 import com.yohoufo.order.service.proxy.CouponProxyService;
22 import com.yohoufo.order.service.proxy.ProductProxyService; 22 import com.yohoufo.order.service.proxy.ProductProxyService;
  23 +import com.yohoufo.order.utils.LoggerUtils;
23 import org.slf4j.Logger; 24 import org.slf4j.Logger;
24 -import org.slf4j.LoggerFactory;  
25 import org.springframework.beans.factory.annotation.Autowired; 25 import org.springframework.beans.factory.annotation.Autowired;
26 import org.springframework.stereotype.Service; 26 import org.springframework.stereotype.Service;
27 import org.springframework.transaction.annotation.Propagation; 27 import org.springframework.transaction.annotation.Propagation;
@@ -30,7 +30,7 @@ import org.springframework.transaction.annotation.Transactional; @@ -30,7 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
30 @Service 30 @Service
31 public class SubmitOrderServiceImpl implements ISubmitOrderService { 31 public class SubmitOrderServiceImpl implements ISubmitOrderService {
32 32
33 - private final static Logger logger = LoggerFactory.getLogger(SubmitOrderServiceImpl.class); 33 + private final static Logger logger = LoggerUtils.getBuyerOrderLogger();
34 34
35 @Autowired 35 @Autowired
36 OrderCreateService orderCreateService; 36 OrderCreateService orderCreateService;
@@ -28,6 +28,10 @@ public class LoggerUtils { @@ -28,6 +28,10 @@ public class LoggerUtils {
28 return buildByName("sellerOrderLog"); 28 return buildByName("sellerOrderLog");
29 } 29 }
30 30
  31 + public static Logger getBuyerOrderLogger(){
  32 + return buildByName("buyerOrderLog");
  33 + }
  34 +
31 static Logger buildByName(String logName){ 35 static Logger buildByName(String logName){
32 return LoggerFactory.getLogger(logName); 36 return LoggerFactory.getLogger(logName);
33 } 37 }
@@ -191,6 +191,23 @@ @@ -191,6 +191,23 @@
191 </encoder> 191 </encoder>
192 </appender> 192 </appender>
193 193
  194 +
  195 + <appender name="BUYER_ORDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
  196 + <file>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/buyer-order.log</file>
  197 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  198 + <!-- 按天回滚 daily -->
  199 + <fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/buyer-order.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
  200 + <!-- 日志最大的历史 60天 -->
  201 + <maxHistory>${yoho.logs.maxHistory}</maxHistory>
  202 + </rollingPolicy>
  203 + <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
  204 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  205 + </triggeringPolicy>
  206 + <encoder>
  207 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
  208 + </encoder>
  209 + </appender>
  210 +
194 <logger name="org.apache.zookeeper.ClientCnxn" level="WARN" /> 211 <logger name="org.apache.zookeeper.ClientCnxn" level="WARN" />
195 <!-- 登录时,如果一个IP在一定时间内登录次数过多,记录日志 appender --> 212 <!-- 登录时,如果一个IP在一定时间内登录次数过多,记录日志 appender -->
196 <logger name="ipLoginMoreLog" level="INFO" additivity="false"> 213 <logger name="ipLoginMoreLog" level="INFO" additivity="false">
@@ -263,4 +280,8 @@ @@ -263,4 +280,8 @@
263 <logger name="sellerOrderLog" level="INFO" additivity="false"> 280 <logger name="sellerOrderLog" level="INFO" additivity="false">
264 <appender-ref ref="SELLER_ORDER" /> 281 <appender-ref ref="SELLER_ORDER" />
265 </logger> 282 </logger>
  283 +
  284 + <logger name="buyerOrderLog" level="INFO" additivity="false">
  285 + <appender-ref ref="BUYER_ORDER" />
  286 + </logger>
266 </configuration> 287 </configuration>
@@ -492,6 +492,22 @@ @@ -492,6 +492,22 @@
492 </encoder> 492 </encoder>
493 </appender> 493 </appender>
494 494
  495 + <appender name="BUYER_ORDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
  496 + <file>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/buyer-order.log</file>
  497 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  498 + <!-- 按天回滚 daily -->
  499 + <fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/buyer-order.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
  500 + <!-- 日志最大的历史 60天 -->
  501 + <maxHistory>${yoho.logs.maxHistory}</maxHistory>
  502 + </rollingPolicy>
  503 + <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
  504 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  505 + </triggeringPolicy>
  506 + <encoder>
  507 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
  508 + </encoder>
  509 + </appender>
  510 +
495 <!-- 数据库操作日志 --> 511 <!-- 数据库操作日志 -->
496 <logger name="java.sql.PreparedStatement" value="${yoho.logs.level}"/> 512 <logger name="java.sql.PreparedStatement" value="${yoho.logs.level}"/>
497 <logger name="java.sql.Connection" value="${yoho.logs.level}"/> 513 <logger name="java.sql.Connection" value="${yoho.logs.level}"/>
@@ -610,4 +626,8 @@ @@ -610,4 +626,8 @@
610 <logger name="sellerOrderLog" level="INFO" additivity="false"> 626 <logger name="sellerOrderLog" level="INFO" additivity="false">
611 <appender-ref ref="SELLER_ORDER" /> 627 <appender-ref ref="SELLER_ORDER" />
612 </logger> 628 </logger>
  629 +
  630 + <logger name="buyerOrderLog" level="INFO" additivity="false">
  631 + <appender-ref ref="BUYER_ORDER" />
  632 + </logger>
613 </configuration> 633 </configuration>