Selaa lähdekoodia

修改日志打印

tianboguang 3 vuotta sitten
vanhempi
commit
333d42a41f

+ 4 - 3
platform-api/src/main/java/com/platform/util/ApiBaseAction.java

@@ -4,8 +4,9 @@ import com.alibaba.fastjson.JSONObject;
 import com.platform.entity.TokenEntity;
 import com.platform.interceptor.AuthorizationInterceptor;
 import com.platform.service.TokenService;
-import org.apache.log4j.Logger;
 import org.apache.shiro.authz.UnauthorizedException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.TypeMismatchException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.propertyeditors.StringTrimmerEditor;
@@ -33,7 +34,7 @@ import java.util.Map;
  * @date 2016年9月2日
  */
 public class ApiBaseAction {
-    protected Logger logger = Logger.getLogger(getClass());
+    protected Logger logger = LoggerFactory.getLogger(this.getClass());
     /**
      * 得到request对象
      */
@@ -83,7 +84,7 @@ public class ApiBaseAction {
 
     public Map<String, Object> toResponsSuccess(Object data) {
         Map<String, Object> rp = toResponsObject(0, "执行成功", data);
-        logger.info("response:" + rp);
+        logger.info("response:{}",JSONObject.toJSONString(rp));
         return rp;
     }