统一log使用规则

This commit is contained in:
shuzheng 2016-10-17 18:05:22 +08:00
parent 334ec465a2
commit 25c9891ba4
3 changed files with 6 additions and 11 deletions

View File

@ -1,18 +1,13 @@
package com.zheng.cms.controller;
import com.zheng.common.util.EhCacheUtil;
import net.sf.ehcache.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.ResourceBundle;
/**
* 缓存controller
@ -23,7 +18,7 @@ import java.util.ResourceBundle;
@RequestMapping("/cache")
public class CacheController {
private static Logger logger = LoggerFactory.getLogger(CacheController.class);
private static Logger _log = LoggerFactory.getLogger(CacheController.class);
private final static String CACHE_NAME = "ehcache_common";
@ -65,7 +60,7 @@ public class CacheController {
String key = request.getParameter("key");
Object object = EhCacheUtil.get(CACHE_NAME, key);
if (null == object) {
logger.debug("【Ehcache】没有找到key={}的记录!", key);
_log.debug("【Ehcache】没有找到key={}的记录!", key);
return "value";
}
return object;

View File

@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletRequest;
@RequestMapping("/category")
public class CategoryController extends BaseController {
private static Logger logger = LoggerFactory.getLogger(CategoryController.class);
private static Logger _log = LoggerFactory.getLogger(CategoryController.class);
@Autowired
private UserService userService;

View File

@ -29,7 +29,7 @@ import java.util.Map;
@RequestMapping("/hello")
public class HelloController {
private static Logger logger = LoggerFactory.getLogger(HelloController.class);
private static Logger _log = LoggerFactory.getLogger(HelloController.class);
private UserServiceImpl userService;
@ -87,8 +87,8 @@ public class HelloController {
@RequestMapping(value = "/save", method = RequestMethod.POST)
public String doSave(@ModelAttribute User user) {
logger.debug("Info of Course:");
logger.debug(ReflectionToStringBuilder.toString(user));
_log.debug("Info of Course:");
_log.debug(ReflectionToStringBuilder.toString(user));
// 在此进行业务操作比如数据库持久化
user.setId(123);