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 serverIp;
|
||||
private String traceCode;
|
||||
private String requestURI;
|
||||
|
||||
/**
|
||||
* serverIp
|
||||
@@ -224,4 +225,17 @@ public class ServicesRequestLog implements Serializable {
|
||||
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;
|
||||
|
||||
public class SwaggerLog extends BaseEntity<SwaggerLog> {
|
||||
private static final long serialVersionUID = 5351369774420087482L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String operator;
|
||||
private String version;
|
||||
private Integer opAction;
|
||||
@@ -16,13 +16,13 @@ public class SwaggerLog extends BaseEntity<SwaggerLog> {
|
||||
private String exceptionInfo;
|
||||
private String serverIp;
|
||||
private String traceCode;
|
||||
private String requestUri;
|
||||
|
||||
private String exception;// 界面的异常信息框
|
||||
|
||||
private Date beginDate; // 开始日期
|
||||
private Date endDate; // 结束日期
|
||||
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
@@ -143,4 +143,12 @@ public class SwaggerLog extends BaseEntity<SwaggerLog> {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public String getRequestUri() {
|
||||
return requestUri;
|
||||
}
|
||||
|
||||
public void setRequestUri(String requestUri) {
|
||||
this.requestUri = requestUri;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -128,9 +128,13 @@ public class LogInterceptor extends BaseService implements HandlerInterceptor {
|
||||
|
||||
}
|
||||
|
||||
String requestURI = request.getRequestURI();
|
||||
// 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="SERVER_IP" jdbcType="VARCHAR" property="serverIp" />
|
||||
<result column="TRACE_CODE" jdbcType="VARCHAR" property="traceCode" />
|
||||
<result column="REQUEST_URI" jdbcType="VARCHAR" property="requestURI" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
ID, OPERATOR, VERSION, OPACTION,OPTIME, REQUEST_CONTENT,
|
||||
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>
|
||||
<select id="getAllLog" parameterType="com.nis.domain.restful.ServicesRequestLogBean"
|
||||
resultMap="ServicesRequestLogMap">
|
||||
@@ -127,6 +128,10 @@
|
||||
<if test="traceCode != null">
|
||||
TRACE_CODE,
|
||||
</if>
|
||||
<if test="requestURI != null">
|
||||
REQUEST_URI,
|
||||
</if>
|
||||
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
|
||||
@@ -166,6 +171,9 @@
|
||||
<if test="traceCode != null">
|
||||
#{traceCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="requestURI != null">
|
||||
#{requestURI,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -18,6 +18,15 @@
|
||||
<if test="traceCode != null and traceCode != ''">
|
||||
AND a.trace_Code=#{traceCode}
|
||||
</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 != ''">
|
||||
AND a.exception_Info LIKE
|
||||
@@ -41,6 +50,11 @@
|
||||
<if test="exception != null and exception != ''">
|
||||
AND a.exception_Info!=''
|
||||
</if>
|
||||
<!-- 默认不显示查询类日志,日志量太大,如果显示在界面选择操作行为即可 -->
|
||||
<if test="opAction == null or opAction == ''">
|
||||
AND a.opAction!=4
|
||||
</if>
|
||||
|
||||
<if test="opAction != null and opAction != ''">
|
||||
AND a.opAction=#{opAction}
|
||||
</if>
|
||||
|
||||
@@ -186,6 +186,7 @@ public abstract class BaseLogService {
|
||||
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getSearchFoundEndTime())) {
|
||||
sdf.setLenient(false);
|
||||
sdf.parse(entity.getSearchFoundEndTime());
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
@@ -201,6 +202,7 @@ public abstract class BaseLogService {
|
||||
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getSearchFoundStartTime())) {
|
||||
sdf.setLenient(false);
|
||||
sdf.parse(entity.getSearchFoundStartTime());
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
|
||||
@@ -105,6 +105,7 @@ public class ServicesRequestLogService {
|
||||
log.setBusinessCode(businessCode);
|
||||
log.setExceptionInfo(exceptionInfo);
|
||||
log.setTraceCode(traceCode);
|
||||
log.setRequestURI(requestURI);
|
||||
try {
|
||||
if(Constants.SERVCER_HOST!=null){
|
||||
log.setServerIp(Constants.SERVCER_HOST);
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
<title>swagger日志管理</title>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$(".tooltips").tooltip();
|
||||
// $(".tooltips").tooltip();
|
||||
$("[data-toggle='popover']").popover();
|
||||
});
|
||||
function page(n,s){
|
||||
$("#pageNo").val(n);
|
||||
@@ -19,19 +20,30 @@
|
||||
<!-- <ul class="nav nav-tabs"> -->
|
||||
<%-- <li class="active"><a href="${ctx}/sys/log/">日志列表</a></li> --%>
|
||||
<!-- </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="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
|
||||
<div>
|
||||
<label>操作行为:</label>
|
||||
<select name="opAction" class="input-medium">
|
||||
<option value="" selected="selected">请选择</option>
|
||||
<option value="1">插入</option>
|
||||
<option value="2">更新</option>
|
||||
<option value="3">删除</option>
|
||||
<option value="4">查询</option>
|
||||
</select>
|
||||
<label>traceCode:</label><input id="traceCode" name="traceCode" type="text" maxlength="30" class="input-mini" value="${swaggerLog.traceCode}"/>
|
||||
<!-- <select name="opAction" class="input-medium"> -->
|
||||
<!-- <option value="" selected="selected">请选择</option> -->
|
||||
<!-- <option value="1">插入</option> -->
|
||||
<!-- <option value="2">更新</option> -->
|
||||
<!-- <option value="3">删除</option> -->
|
||||
<!-- <option value="4">查询</option> -->
|
||||
<!-- </select> -->
|
||||
|
||||
<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>请求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}"/>
|
||||
@@ -44,20 +56,28 @@
|
||||
|
||||
<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>
|
||||
</form:form>
|
||||
<sys:message content="${message}"/>
|
||||
<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");%>
|
||||
<c:forEach items="${page.list}" var="swaggerLog">
|
||||
<tr>
|
||||
<td>${swaggerLog.requestUri}</td>
|
||||
<td>
|
||||
<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>
|
||||
<%-- <a data-original-title="${fn:escapeXml(swaggerLog.requestContent) }" class="tooltips" data-flag="false" --%>
|
||||
<%-- 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>${swaggerLog.traceCode}</td>
|
||||
<td>${swaggerLog.businessCode}</td>
|
||||
<td>
|
||||
<c:if test="${swaggerLog.opAction eq 1}">插入</c:if>
|
||||
<c:if test="${swaggerLog.opAction eq 2}">更新</c:if>
|
||||
@@ -67,7 +87,7 @@
|
||||
</td>
|
||||
<td><strong>${swaggerLog.requestIp}</strong></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>
|
||||
<c:if test="${not empty swaggerLog.exceptionInfo}"><tr>
|
||||
<td colspan="8" style="word-wrap:break-word;word-break:break-all;">
|
||||
|
||||
Reference in New Issue
Block a user