Commit 0f1841bc authored by Quxl's avatar Quxl

x

parent 10535be2
...@@ -9,7 +9,7 @@ public interface LogService { ...@@ -9,7 +9,7 @@ public interface LogService {
List<Map<String, Object>> queryLogList(String type, String username, Page page); List<Map<String, Object>> queryLogList(String type, String username, Page page);
void saveErrorLog(Throwable ex); void saveErrorLog(String path, Throwable ex);
List<Map<String, Object>> queryErrorList(Page page); List<Map<String, Object>> queryErrorList(Page page);
......
...@@ -4,8 +4,6 @@ import java.util.Date; ...@@ -4,8 +4,6 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -14,7 +12,6 @@ import com.egolm.common.jdbc.JdbcTemplate; ...@@ -14,7 +12,6 @@ import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page; import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.LogService; import com.egolm.film.api.service.LogService;
import com.egolm.film.bean.Fc_logs_error; import com.egolm.film.bean.Fc_logs_error;
import com.egolm.film.config.WebMvcConfig;
import com.egolm.film.util.SqlWhere; import com.egolm.film.util.SqlWhere;
@Service @Service
...@@ -32,15 +29,10 @@ public class LogServiceImpl implements LogService { ...@@ -32,15 +29,10 @@ public class LogServiceImpl implements LogService {
} }
@Override @Override
public void saveErrorLog(Throwable ex) { public void saveErrorLog(String path, Throwable ex) {
String requestUri = null;
HttpServletRequest request = WebMvcConfig.getRequest();
if(request != null) {
requestUri = request.getRequestURI().substring(request.getContextPath().length());
}
Fc_logs_error error = new Fc_logs_error(); Fc_logs_error error = new Fc_logs_error();
error.setTitle(ex.getMessage()); error.setTitle(ex.getMessage());
error.setPath(requestUri); error.setPath(path);
error.setError(this.toStackString(ex).toString()); error.setError(this.toStackString(ex).toString());
error.setCreate_time(new Date()); error.setCreate_time(new Date());
jdbcTemplate.save(error); jdbcTemplate.save(error);
......
...@@ -43,7 +43,7 @@ public class ExceptionHandler implements HandlerExceptionResolver { ...@@ -43,7 +43,7 @@ public class ExceptionHandler implements HandlerExceptionResolver {
if(displayInLog) { if(displayInLog) {
logger.error("", ex); logger.error("", ex);
try { try {
logService.saveErrorLog(ex); logService.saveErrorLog(request.getRequestURI(), ex);
} catch (Exception e) { } catch (Exception e) {
logger.error("错误日志保存失败", e); logger.error("错误日志保存失败", e);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment