Merge branch 'Release-1.1' into develop
This commit is contained in:
@@ -42,6 +42,7 @@ public class ServicesRequestLog implements Serializable {
|
|||||||
private String exceptionInfo;
|
private String exceptionInfo;
|
||||||
private String serverIp;
|
private String serverIp;
|
||||||
private String traceCode;
|
private String traceCode;
|
||||||
|
private String requestURI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* serverIp
|
* serverIp
|
||||||
@@ -224,4 +225,17 @@ public class ServicesRequestLog implements Serializable {
|
|||||||
this.traceCode = traceCode;
|
this.traceCode = traceCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param requestURI the requestURI to set
|
||||||
|
*/
|
||||||
|
public void setRequestURI(String requestURI) {
|
||||||
|
this.requestURI = requestURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the requestURI
|
||||||
|
*/
|
||||||
|
public String getRequestURI() {
|
||||||
|
return requestURI;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.nis.domain;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class SwaggerLog extends BaseEntity<SwaggerLog> {
|
public class SwaggerLog extends BaseEntity<SwaggerLog> {
|
||||||
private static final long serialVersionUID = 5351369774420087482L;
|
private static final long serialVersionUID = 1L;
|
||||||
private String operator;
|
private String operator;
|
||||||
private String version;
|
private String version;
|
||||||
private Integer opAction;
|
private Integer opAction;
|
||||||
@@ -16,13 +16,13 @@ public class SwaggerLog extends BaseEntity<SwaggerLog> {
|
|||||||
private String exceptionInfo;
|
private String exceptionInfo;
|
||||||
private String serverIp;
|
private String serverIp;
|
||||||
private String traceCode;
|
private String traceCode;
|
||||||
|
private String requestUri;
|
||||||
|
|
||||||
private String exception;// 界面的异常信息框
|
private String exception;// 界面的异常信息框
|
||||||
|
|
||||||
private Date beginDate; // 开始日期
|
private Date beginDate; // 开始日期
|
||||||
private Date endDate; // 结束日期
|
private Date endDate; // 结束日期
|
||||||
|
|
||||||
|
|
||||||
public String getOperator() {
|
public String getOperator() {
|
||||||
return operator;
|
return operator;
|
||||||
}
|
}
|
||||||
@@ -143,4 +143,12 @@ public class SwaggerLog extends BaseEntity<SwaggerLog> {
|
|||||||
this.endDate = endDate;
|
this.endDate = endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getRequestUri() {
|
||||||
|
return requestUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRequestUri(String requestUri) {
|
||||||
|
this.requestUri = requestUri;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ public class LogInterceptor extends BaseService implements HandlerInterceptor {
|
|||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
String requestURI = request.getRequestURI();
|
String requestURI = request.getRequestURI();
|
||||||
// logger.info("请求路径是:" + requestURI);
|
// logger.info("请求路径是:" + requestURI);
|
||||||
// logger.info("请求参数是:" + getBodyString(request));
|
// logger.info("请求参数是:" + getBodyString(request));
|
||||||
long beginTime = System.currentTimeMillis();// 1、开始时间
|
long beginTime = System.currentTimeMillis();// 1、开始时间
|
||||||
timeThreadLocal.set(beginTime); // 线程绑定变量(该数据只有当前请求的线程可见)
|
timeThreadLocal.set(beginTime); // 线程绑定变量(该数据只有当前请求的线程可见)
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
@@ -128,9 +128,13 @@ public class LogInterceptor extends BaseService implements HandlerInterceptor {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存日志
|
String requestURI = request.getRequestURI();
|
||||||
LogUtils.saveLog(request, handler, ex, null, consumerTime);
|
// swagger日志请求和行为日志请求不记录请求日志
|
||||||
|
if (!requestURI.equals("/galaxy/nis/sys/log/swaggerLogList")
|
||||||
|
&& !requestURI.equals("/galaxy/nis/sys/log/list")) {
|
||||||
|
// 保存日志
|
||||||
|
LogUtils.saveLog(request, handler, ex, null, consumerTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,11 +15,12 @@
|
|||||||
<result column="EXCEPTION_INFO" jdbcType="BLOB" property="exceptionInfo" typeHandler="com.nis.util.BlobTypeHandler"/>
|
<result column="EXCEPTION_INFO" jdbcType="BLOB" property="exceptionInfo" typeHandler="com.nis.util.BlobTypeHandler"/>
|
||||||
<result column="SERVER_IP" jdbcType="VARCHAR" property="serverIp" />
|
<result column="SERVER_IP" jdbcType="VARCHAR" property="serverIp" />
|
||||||
<result column="TRACE_CODE" jdbcType="VARCHAR" property="traceCode" />
|
<result column="TRACE_CODE" jdbcType="VARCHAR" property="traceCode" />
|
||||||
|
<result column="REQUEST_URI" jdbcType="VARCHAR" property="requestURI" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
ID, OPERATOR, VERSION, OPACTION,OPTIME, REQUEST_CONTENT,
|
ID, OPERATOR, VERSION, OPACTION,OPTIME, REQUEST_CONTENT,
|
||||||
REQUEST_TIME,REQUEST_IP,
|
REQUEST_TIME,REQUEST_IP,
|
||||||
CONSUMER_TIME,BUSINESS_CODE,EXCEPTION_INFO,SERVER_IP,TRACE_CODE
|
CONSUMER_TIME,BUSINESS_CODE,EXCEPTION_INFO,SERVER_IP,TRACE_CODE,REQUEST_URI
|
||||||
</sql>
|
</sql>
|
||||||
<select id="getAllLog" parameterType="com.nis.domain.restful.ServicesRequestLogBean"
|
<select id="getAllLog" parameterType="com.nis.domain.restful.ServicesRequestLogBean"
|
||||||
resultMap="ServicesRequestLogMap">
|
resultMap="ServicesRequestLogMap">
|
||||||
@@ -127,6 +128,10 @@
|
|||||||
<if test="traceCode != null">
|
<if test="traceCode != null">
|
||||||
TRACE_CODE,
|
TRACE_CODE,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="requestURI != null">
|
||||||
|
REQUEST_URI,
|
||||||
|
</if>
|
||||||
|
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
|
||||||
@@ -166,6 +171,9 @@
|
|||||||
<if test="traceCode != null">
|
<if test="traceCode != null">
|
||||||
#{traceCode,jdbcType=VARCHAR},
|
#{traceCode,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="requestURI != null">
|
||||||
|
#{requestURI,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
#{beginDate} AND #{endDate}
|
#{beginDate} AND #{endDate}
|
||||||
|
|
||||||
<if test="requestContent != null and requestContent != ''">
|
<if test="requestContent != null and requestContent != ''">
|
||||||
AND a.request_Content LIKE
|
AND a.request_Content LIKE
|
||||||
<if test="dbName == 'oracle'">'%'||#{requestContent}||'%'</if>
|
<if test="dbName == 'oracle'">'%'||#{requestContent}||'%'</if>
|
||||||
<if test="dbName == 'mssql'">'%'+#{requestContent}+'%'</if>
|
<if test="dbName == 'mssql'">'%'+#{requestContent}+'%'</if>
|
||||||
<if test="dbName == 'mysql'">CONCAT('%', #{requestContent}, '%')</if>
|
<if test="dbName == 'mysql'">CONCAT('%', #{requestContent}, '%')</if>
|
||||||
@@ -18,22 +18,31 @@
|
|||||||
<if test="traceCode != null and traceCode != ''">
|
<if test="traceCode != null and traceCode != ''">
|
||||||
AND a.trace_Code=#{traceCode}
|
AND a.trace_Code=#{traceCode}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="businessCode != null and businessCode != ''">
|
||||||
|
AND a.business_Code=#{businessCode}
|
||||||
|
</if>
|
||||||
|
<if test="requestUri != null and requestUri != ''">
|
||||||
|
AND a.REQUEST_URI LIKE
|
||||||
|
<if test="dbName == 'oracle'">'%'||#{requestUri}||'%'</if>
|
||||||
|
<if test="dbName == 'mssql'">'%'+#{requestUri}+'%'</if>
|
||||||
|
<if test="dbName == 'mysql'">CONCAT('%', #{requestUri}, '%')</if>
|
||||||
|
</if>
|
||||||
|
|
||||||
<if test="exceptionInfo != null and exceptionInfo != ''">
|
<if test="exceptionInfo != null and exceptionInfo != ''">
|
||||||
AND a.exception_Info LIKE
|
AND a.exception_Info LIKE
|
||||||
<if test="dbName == 'oracle'">'%'||#{exceptionInfo}||'%'</if>
|
<if test="dbName == 'oracle'">'%'||#{exceptionInfo}||'%'</if>
|
||||||
<if test="dbName == 'mssql'">'%'+#{exceptionInfo}+'%'</if>
|
<if test="dbName == 'mssql'">'%'+#{exceptionInfo}+'%'</if>
|
||||||
<if test="dbName == 'mysql'">CONCAT('%', #{exceptionInfo}, '%')</if>
|
<if test="dbName == 'mysql'">CONCAT('%', #{exceptionInfo}, '%')</if>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="requestIp != null and requestIp != ''">
|
<if test="requestIp != null and requestIp != ''">
|
||||||
AND a.request_ip like
|
AND a.request_ip like
|
||||||
<if test="dbName == 'oracle'">'%'||#{requestIp}||'%'</if>
|
<if test="dbName == 'oracle'">'%'||#{requestIp}||'%'</if>
|
||||||
<if test="dbName == 'mssql'">'%'+#{requestIp}+'%'</if>
|
<if test="dbName == 'mssql'">'%'+#{requestIp}+'%'</if>
|
||||||
<if test="dbName == 'mysql'">CONCAT('%', #{requestIp}, '%')</if>
|
<if test="dbName == 'mysql'">CONCAT('%', #{requestIp}, '%')</if>
|
||||||
</if>
|
</if>
|
||||||
<if test="serverIp != null and serverIp != ''">
|
<if test="serverIp != null and serverIp != ''">
|
||||||
AND a.server_Ip like
|
AND a.server_Ip like
|
||||||
<if test="dbName == 'oracle'">'%'||#{serverIp}||'%'</if>
|
<if test="dbName == 'oracle'">'%'||#{serverIp}||'%'</if>
|
||||||
<if test="dbName == 'mssql'">'%'+#{serverIp}+'%'</if>
|
<if test="dbName == 'mssql'">'%'+#{serverIp}+'%'</if>
|
||||||
<if test="dbName == 'mysql'">CONCAT('%', #{serverIp}, '%')</if>
|
<if test="dbName == 'mysql'">CONCAT('%', #{serverIp}, '%')</if>
|
||||||
@@ -41,6 +50,11 @@
|
|||||||
<if test="exception != null and exception != ''">
|
<if test="exception != null and exception != ''">
|
||||||
AND a.exception_Info!=''
|
AND a.exception_Info!=''
|
||||||
</if>
|
</if>
|
||||||
|
<!-- 默认不显示查询类日志,日志量太大,如果显示在界面选择操作行为即可 -->
|
||||||
|
<if test="opAction == null or opAction == ''">
|
||||||
|
AND a.opAction!=4
|
||||||
|
</if>
|
||||||
|
|
||||||
<if test="opAction != null and opAction != ''">
|
<if test="opAction != null and opAction != ''">
|
||||||
AND a.opAction=#{opAction}
|
AND a.opAction=#{opAction}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -186,6 +186,7 @@ public abstract class BaseLogService {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (!StringUtil.isBlank(entity.getSearchFoundEndTime())) {
|
if (!StringUtil.isBlank(entity.getSearchFoundEndTime())) {
|
||||||
|
sdf.setLenient(false);
|
||||||
sdf.parse(entity.getSearchFoundEndTime());
|
sdf.parse(entity.getSearchFoundEndTime());
|
||||||
}
|
}
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
@@ -201,6 +202,7 @@ public abstract class BaseLogService {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (!StringUtil.isBlank(entity.getSearchFoundStartTime())) {
|
if (!StringUtil.isBlank(entity.getSearchFoundStartTime())) {
|
||||||
|
sdf.setLenient(false);
|
||||||
sdf.parse(entity.getSearchFoundStartTime());
|
sdf.parse(entity.getSearchFoundStartTime());
|
||||||
}
|
}
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ public class ServicesRequestLogService {
|
|||||||
log.setBusinessCode(businessCode);
|
log.setBusinessCode(businessCode);
|
||||||
log.setExceptionInfo(exceptionInfo);
|
log.setExceptionInfo(exceptionInfo);
|
||||||
log.setTraceCode(traceCode);
|
log.setTraceCode(traceCode);
|
||||||
|
log.setRequestURI(requestURI);
|
||||||
try {
|
try {
|
||||||
if(Constants.SERVCER_HOST!=null){
|
if(Constants.SERVCER_HOST!=null){
|
||||||
log.setServerIp(Constants.SERVCER_HOST);
|
log.setServerIp(Constants.SERVCER_HOST);
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
<title>swagger日志管理</title>
|
<title>swagger日志管理</title>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$(".tooltips").tooltip();
|
// $(".tooltips").tooltip();
|
||||||
|
$("[data-toggle='popover']").popover();
|
||||||
});
|
});
|
||||||
function page(n,s){
|
function page(n,s){
|
||||||
$("#pageNo").val(n);
|
$("#pageNo").val(n);
|
||||||
@@ -19,19 +20,30 @@
|
|||||||
<!-- <ul class="nav nav-tabs"> -->
|
<!-- <ul class="nav nav-tabs"> -->
|
||||||
<%-- <li class="active"><a href="${ctx}/sys/log/">日志列表</a></li> --%>
|
<%-- <li class="active"><a href="${ctx}/sys/log/">日志列表</a></li> --%>
|
||||||
<!-- </ul> -->
|
<!-- </ul> -->
|
||||||
<form:form id="searchForm" action="${ctx}/sys/log/swaggerLogList" method="post" class="breadcrumb form-search">
|
<form:form modelAttribute="swaggerLog" id="searchForm" action="${ctx}/sys/log/swaggerLogList" method="post" class="breadcrumb form-search">
|
||||||
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
|
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
|
||||||
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
|
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
|
||||||
<div>
|
<div>
|
||||||
<label>操作行为:</label>
|
<label>操作行为:</label>
|
||||||
<select name="opAction" class="input-medium">
|
<!-- <select name="opAction" class="input-medium"> -->
|
||||||
<option value="" selected="selected">请选择</option>
|
<!-- <option value="" selected="selected">请选择</option> -->
|
||||||
<option value="1">插入</option>
|
<!-- <option value="1">插入</option> -->
|
||||||
<option value="2">更新</option>
|
<!-- <option value="2">更新</option> -->
|
||||||
<option value="3">删除</option>
|
<!-- <option value="3">删除</option> -->
|
||||||
<option value="4">查询</option>
|
<!-- <option value="4">查询</option> -->
|
||||||
</select>
|
<!-- </select> -->
|
||||||
<label>traceCode:</label><input id="traceCode" name="traceCode" type="text" maxlength="30" class="input-mini" value="${swaggerLog.traceCode}"/>
|
|
||||||
|
<form:select path="opAction" class="input-medium">
|
||||||
|
<form:option value="">请选择</form:option>
|
||||||
|
<form:option value="1">插入</form:option>
|
||||||
|
<form:option value="2">更新</form:option>
|
||||||
|
<form:option value="3">删除</form:option>
|
||||||
|
<form:option value="4">查询</form:option>
|
||||||
|
</form:select>
|
||||||
|
|
||||||
|
|
||||||
|
<label>TRACECODE:</label><input id="traceCode" name="traceCode" type="text" maxlength="30" class="input-mini" value="${swaggerLog.traceCode}"/>
|
||||||
|
<label>BUSINESSCODE:</label><input id="businessCode" name="businessCode" type="text" maxlength="30" class="input-mini" value="${swaggerLog.businessCode}"/>
|
||||||
<label>异常信息:</label><input id="exceptionInfo" name="exceptionInfo" type="text" maxlength="500" class="input-mini" value="${swaggerLog.exceptionInfo}"/>
|
<label>异常信息:</label><input id="exceptionInfo" name="exceptionInfo" type="text" maxlength="500" class="input-mini" value="${swaggerLog.exceptionInfo}"/>
|
||||||
<label>请求ip:</label><input id="requestIp" name="requestIp" type="text" maxlength="50" class="input-mini" value="${swaggerLog.requestIp}"/>
|
<label>请求ip:</label><input id="requestIp" name="requestIp" type="text" maxlength="50" class="input-mini" value="${swaggerLog.requestIp}"/>
|
||||||
<label>服务端ip:</label><input id="serverIp" name="serverIp" type="text" maxlength="50" class="input-mini" value="${swaggerLog.serverIp}"/>
|
<label>服务端ip:</label><input id="serverIp" name="serverIp" type="text" maxlength="50" class="input-mini" value="${swaggerLog.serverIp}"/>
|
||||||
@@ -44,20 +56,28 @@
|
|||||||
|
|
||||||
<input id="exception" name="exception" type="checkbox"${swaggerLog.exception eq '1'?' checked':''} value="1"/>只查询异常信息</label>
|
<input id="exception" name="exception" type="checkbox"${swaggerLog.exception eq '1'?' checked':''} value="1"/>只查询异常信息</label>
|
||||||
|
|
||||||
<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
|
<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/> <label style="color: red">默认<strong style="font-size: 20px;">不显示查询类</strong>日志,如需显示请选择操作行为</label>
|
||||||
</div>
|
</div>
|
||||||
</form:form>
|
</form:form>
|
||||||
<sys:message content="${message}"/>
|
<sys:message content="${message}"/>
|
||||||
<table id="contentTable" class="table table-striped table-bordered table-condensed">
|
<table id="contentTable" class="table table-striped table-bordered table-condensed">
|
||||||
<thead><tr><th>请求内容</th><th>traceCode</th><th>操作行为</th><th>请求ip</th><th>服务端ip</th><th>请求时间</th></thead>
|
<thead><tr><th>请求地址</th><th>请求内容</th><th>TRACECODE</th><th>BUSINESSCODE</th><th>操作行为</th><th>请求ip</th><th>服务端ip</th><th>请求时间</th></thead>
|
||||||
<tbody><%request.setAttribute("strEnter", "\n");request.setAttribute("strTab", "\t");%>
|
<tbody><%request.setAttribute("strEnter", "\n");request.setAttribute("strTab", "\t");%>
|
||||||
<c:forEach items="${page.list}" var="swaggerLog">
|
<c:forEach items="${page.list}" var="swaggerLog">
|
||||||
<tr>
|
<tr>
|
||||||
|
<td>${swaggerLog.requestUri}</td>
|
||||||
<td>
|
<td>
|
||||||
<a data-original-title="${fn:escapeXml(swaggerLog.requestContent) }" class="tooltips" data-flag="false"
|
<%-- <a data-original-title="${fn:escapeXml(swaggerLog.requestContent) }" class="tooltips" data-flag="false" --%>
|
||||||
data-html="true" data-placement="top"> ${fn:substring(swaggerLog.requestContent,0,20) }</a>
|
<%-- data-placement="bottom"> ${fn:substring(swaggerLog.requestContent,0,20) }</a> --%>
|
||||||
|
<%-- <a title="${fn:escapeXml(swaggerLog.requestContent) }" class="tooltips" data-toggle="tooltip" --%>
|
||||||
|
<%-- data-placement="top"> ${fn:substring(swaggerLog.requestContent,0,20) }</a> --%>
|
||||||
|
|
||||||
|
|
||||||
|
<a title="${fn:escapeXml(swaggerLog.requestContent) }" data-container="body" data-toggle="popover"
|
||||||
|
data-placement="bottom"> ${fn:substring(swaggerLog.requestContent,0,20) }</a>
|
||||||
</td>
|
</td>
|
||||||
<td>${swaggerLog.traceCode}</td>
|
<td>${swaggerLog.traceCode}</td>
|
||||||
|
<td>${swaggerLog.businessCode}</td>
|
||||||
<td>
|
<td>
|
||||||
<c:if test="${swaggerLog.opAction eq 1}">插入</c:if>
|
<c:if test="${swaggerLog.opAction eq 1}">插入</c:if>
|
||||||
<c:if test="${swaggerLog.opAction eq 2}">更新</c:if>
|
<c:if test="${swaggerLog.opAction eq 2}">更新</c:if>
|
||||||
@@ -67,7 +87,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td><strong>${swaggerLog.requestIp}</strong></td>
|
<td><strong>${swaggerLog.requestIp}</strong></td>
|
||||||
<td>${swaggerLog.serverIp}</td>
|
<td>${swaggerLog.serverIp}</td>
|
||||||
<td><fmt:formatDate value="${swaggerLog.requestTime}" type="both"/></td>
|
<td><fmt:formatDate value="${swaggerLog.requestTime}" type="both" pattern="yyyy-MM-dd HH:mm:ss"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<c:if test="${not empty swaggerLog.exceptionInfo}"><tr>
|
<c:if test="${not empty swaggerLog.exceptionInfo}"><tr>
|
||||||
<td colspan="8" style="word-wrap:break-word;word-break:break-all;">
|
<td colspan="8" style="word-wrap:break-word;word-break:break-all;">
|
||||||
|
|||||||
Reference in New Issue
Block a user