2018-06-03 22:26:41 +08:00

98 lines
3.6 KiB
Plaintext

<%@page import="com.amarsoft.are.io.FileFilterByName"%>
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/IncludeBegin.jsp"%>
<%
String dataHome = CurPage.getParameter("LogDir");
boolean isOnlyLog=false;
if (dataHome==null || "".equals(dataHome)) {
isOnlyLog=true;
try {
InputStream fin = new FileInputStream(ARE.getServiceStub("LOG").getProperty("com.amarsoft.are.log.impl.DefaultLogFactory.logProperties"));
Properties props = new Properties();
props.load(fin);
dataHome = ARE.replaceEnvVar(props.getProperty("com.amarsoft.are.log.impl.FileHandler.pattern"));
fin.close();
} catch (Exception e) {
e.printStackTrace();
}
}
java.io.File logDir = new java.io.File(dataHome);
if (!logDir.isDirectory()) logDir = logDir.getParentFile();
if (logDir == null) {
out.println("<font color='red'>No Directory Define</font>");
}
%>
<body leftmargin="0" topmargin="0" >
<iframe name="MyAtt" width=100% height=0 frameborder=0 hspace=0 vspace=0 marginwidth=0 marginheight=0 scrolling="no"> </iframe>
<form id="form_1" name="form_1" method=post action="<%=sWebRootPath%>/servlet/view/file?CompClientID=<%=sCompClientID%>" target=MyAtt>
<div style="display:none">
<input id="filename" name="filename">
</div>
</form>
<div style="position:absolute;width:100%; height:100%; z-index:1; overflow: auto" align="center">
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td style='width:320px;'>定义的日志路径:</td>
<td id="logdir" colspan="3"><%=logDir.getPath()%></td>
</tr>
<tr>
<th nowrap style='width:320px;' bgcolor=#F0F0F0>日志文件</th>
<th nowrap bgcolor=#F0F0F0>最后修改时间</th>
<th nowrap bgcolor=#F0F0F0>大小(K)</th>
<th nowrap bgcolor=#F0F0F0>大小(M)</th>
</tr>
<%
if(logDir.exists() && logDir.isDirectory()){
FileFilterByName ff = new FileFilterByName("",".*");
if (isOnlyLog){ff = new FileFilterByName("",".*\\.log");}
ff.setDirectoryInclude(false);
java.io.File lf[] = logDir.listFiles((java.io.FileFilter)ff);
for(int j=0;j<lf.length;j++){
String sFile = lf[j].getPath().replaceAll("\\\\","/");
%>
<tr align="left">
<td nowrap style='width:320px;'>
<a href="javascript:void()" onclick="downloadF('<%=sFile%>');return false;" hidefocus="">
<%=lf[j].getName()%></a>
</td>
<td nowrap><%=new java.util.Date(lf[j].lastModified()).toLocaleString()%></td>
<td nowrap><%=lf[j].length()/1024+1%>K</td>
<td nowrap><%=lf[j].length()/1024/1024+1%>M</td>
</tr>
<%}
}else{%>
<tr>
<td colspan="4">定义的日志路径:[<%=logDir.getPath()%>]不存在</td>
</tr>
<%}%>
</table>
</div>
<script type="text/javascript">
function downloadF(file){
$('#filename').val(file);
form_1.submit();
}
$(function(){
$('#logdir').dblclick(function(){
var td = $(this);
// 根据表格文本创建文本框 并加入表表中--文本框的样式自己调整
var text = td.text();
var txt = $("<input type='text' style='width:480px;'>").val(text);
txt.blur(function(){
// 失去焦点,保存值。于服务器交互自己再写,最好ajax
var newText = $(this).val();
// 移除文本框,显示新值
$(this).remove();
td.text(newText);
AsControl.OpenView("/AppConfig/ControlCenter/LogManage/AppLogFileList.jsp","LogDir="+newText,"_self");
});
td.text("");
td.append(txt);
});
});
</script>
</body>
<%@ include file="/IncludeEnd.jsp"%>