Commit 0f1841bc authored by Quxl's avatar Quxl

x

parent 10535be2
......@@ -9,7 +9,7 @@ public interface LogService {
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);
......
......@@ -4,8 +4,6 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -14,7 +12,6 @@ import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.LogService;
import com.egolm.film.bean.Fc_logs_error;
import com.egolm.film.config.WebMvcConfig;
import com.egolm.film.util.SqlWhere;
@Service
......@@ -32,15 +29,10 @@ public class LogServiceImpl implements LogService {
}
@Override
public void saveErrorLog(Throwable ex) {
String requestUri = null;
HttpServletRequest request = WebMvcConfig.getRequest();
if(request != null) {
requestUri = request.getRequestURI().substring(request.getContextPath().length());
}
public void saveErrorLog(String path, Throwable ex) {
Fc_logs_error error = new Fc_logs_error();
error.setTitle(ex.getMessage());
error.setPath(requestUri);
error.setPath(path);
error.setError(this.toStackString(ex).toString());
error.setCreate_time(new Date());
jdbcTemplate.save(error);
......
......@@ -43,7 +43,7 @@ public class ExceptionHandler implements HandlerExceptionResolver {
if(displayInLog) {
logger.error("", ex);
try {
logService.saveErrorLog(ex);
logService.saveErrorLog(request.getRequestURI(), ex);
} catch (Exception 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