viewlogsystem.jsp

来自「一个完整的网络订餐系统」· JSP 代码 · 共 169 行

JSP
169
字号
<%--
 - $Header: /cvsroot/mvnforum/mvnforum/srcweb/mvnplugin/mvnforum/admin/viewlogsystem.jsp,v 1.12 2005/01/18 11:01:39 minhnn Exp $
 - $Author: minhnn $
 - $Revision: 1.12 $
 - $Date: 2005/01/18 11:01:39 $
 -
 - ====================================================================
 -
 - Copyright (C) 2002-2005 by MyVietnam.net
 -
 - This program is free software; you can redistribute it and/or
 - modify it under the terms of the GNU General Public License
 - as published by the Free Software Foundation; either version 2
 - of the License, or any later version.
 -
 - All copyright notices regarding mvnForum MUST remain intact
 - in the scripts and in the outputted HTML.
 - The "powered by" text/logo with a link back to
 - http://www.mvnForum.com and http://www.MyVietnam.net in the
 - footer of the pages MUST remain visible when the pages
 - are viewed on the internet or intranet.
 -
 - This program is distributed in the hope that it will be useful,
 - but WITHOUT ANY WARRANTY; without even the implied warranty of
 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 - GNU General Public License for more details.
 -
 - You should have received a copy of the GNU General Public License
 - along with this program; if not, write to the Free Software
 - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 -
 - Support can be obtained from support forums at:
 - http://www.mvnForum.com/mvnforum/index
 -
 - Correspondence and Marketing Questions can be sent to:
 - info@MyVietnam.net
 -
 - @author: Minh Nguyen  minhnn@MyVietnam.net
 - @author: Mai  Nguyen  mai.nh@MyVietnam.net
 --%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page errorPage="fatalerror.jsp"%>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="net.myvietnam.mvncore.util.*" %>
<%@ page import="com.mvnforum.db.*" %>
<%@ page import="com.mvnforum.MVNForumConstant" %>
<%@ page import="com.mvnforum.MVNForumConfig" %>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ include file="inc_common.jsp"%>
<fmt:bundle basename="mvnForum_i18n">
<html>
<head>
  <title><fmt:message key="mvnforum.common.forum.title_name"/> - Log File Management</title>
<%@ include file="/mvnplugin/mvnforum/meta.jsp"%>
<link href="<%=onlineUser.getCssPath()%>" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0">
<%@ include file="inc_js_checkvalid_myvietnamlib.jsp"%>
<%@ include file="header.jsp"%>
<br/>
<%
String logs[]      = {"ALL", "TRACE",      "DEBUG",      "INFO",      "WARN" ,     "ERROR",      "FATAL"};
String logValues[] = {"All", "Only Trace", "Only Debug", "Only Info", "Only Warn", "Only Error", "Only Fatal"};
int lineNums[]     = { 25, 50 , 100, 200, 400, 800 };

int lineCount = ParamUtil.getParameterInt(request, "linecount", 25);
String log = ParamUtil.getParameter(request, "log");
if (log.length() == 0 ) {
  log = "ALL";
}
String logDir = ParamUtil.getAttribute(request, "LogDir");
String logFileName = ParamUtil.getAttribute(request, "LogFileName");
String logFileSize = ParamUtil.getAttribute(request, "LogFileSize");
String logFileHumanSize = ParamUtil.getAttribute(request, "LogFileHumanSize");
String fileName = ParamUtil.getAttribute(request, "FileName");
%>

<table width="95%" align="center">
  <tr class="nav">
    <td><img src="<%=contextPath%>/mvnplugin/mvnforum/images/nav.gif"></td>
    <td width="100%" nowrap>
    <a class="nav" href="<%=indexUrl%>"><fmt:message key="mvnforum.common.nav.index"/></a>&nbsp;&raquo;&nbsp;
    <a class="nav" href="index">Admin CP</a>&nbsp;&raquo;&nbsp;
    Log File Management
    </td>
  </tr>
</table>
<br/>
<table class="tborder" width="95%" cellspacing="1" cellpadding="3" align="center">
  <tr class="pagedesc">
    <td>
    <b>Log File Management</b> is a place that you can manage your log files. You should config the log file first. 
    If you choose <a href="http://logging.apache.org/log4j/docs/">Log4j</a>, then config file log4j.properties. 
    Or if you choose <a href="http://jlo.jzonic.org">Jlo</a>, please config file jlo_logging.xml.
    Please note that Log4j is more common and should be used, however, sometime Log4j could not work on JRun 4 or Tomcat 5,
    Tomcat 5.5, then you should use Jlo as an alternative logging solution.<br/>
    After that, you have to config mvnforum.xml to let mvnForum know your current log file. Please note that the log 
    file must be in folder mvnForumHome/log to let mvnForum work properly.<br/>
    With this log management tool, you can view content of the current log file (show all or with filer). You can backup the log file
    to the log directory. Usually, when backup the log file, you should empty it to reduce the log file size. You can
    list all archieved log files, download them or delete them if you want.
    <br/>
    Choose below tasks to continue:<br/>
    <a href="listlogfiles" class='command'>List log files</a> (you can also download or delete archieved log files)<br/>
    <a href="backupsystemlog" class='command'>Backup the system log</a> (take a few minutes. Depend on the system log size)<br/>
    <a href="backupsystemlog?empty=yes" class='command'>Backup the system log then empty the file</a> (take a few minutes. Depend on the system log size)
    </td>
  </tr>
</table>
<br/>
<form action="viewlogsystem" name="submitform">
<input type="hidden" name="filename" value="<%=fileName%>">
<table class="tborder" width="95%" cellspacing="1" cellpadding="3" align="center">
  <tr class="theader">
    <td colspan="2">Log file Information:</td>
  </tr>
  <tr class="trow1">
    <td>File directory:</td>
    <td class="messageText"><%=logDir%></td>
  </tr>
  <tr class="trow2">
    <td>File log name:</td>
    <td class="messageText"><%=logFileName%></td>
  </tr>
  <tr class="trow1">
    <td>File log size:</td>
    <td class="messageText"><%=logFileHumanSize%> (<%=logFileSize%> bytes)</td>
  </tr>
  <tr class="trow2">
    <td>How many lines do you want to view?</td>
    <td>
      <select name="linecount" onChange="document.submitform.submit();">
       <% for ( int i = 0 ; i < lineNums.length; i ++ ) {%>
        <option value='<%=lineNums[i]%>' <%if ( lineNums[i] == lineCount ) {%> selected <%}%> ><%=lineNums[i]%></option>
       <%}%> 
      </select> Before filter
      <select name="log" onChange="document.submitform.submit();"> 
      <% for ( int i = 0 ; i < logs.length ; i ++ ) {%>
        <option <%if ( log.equals(logs[i]) ) {%> selected <%}%> value='<%=logs[i]%>'/><%=logValues[i]%><br/>
      <%}%>
      </select>
    </td>
  </tr>
</table> 
</form>

<br/>
<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr class="theader">
    <td>Line</td>
    <td width="100%" align="center">Content</td>
  </tr>
  <tr>
    <td colspan="2">
      <iframe src='logframe?filename=<%=fileName%>&amp;linecount=<%=lineCount%>&amp;log=<%=log%>' align='center'
        frameborder="0" height="400" width="100%" marginheight="0" marginwidth="0" scrolling="auto"></iframe>
    </td>
  </tr>
</table>  
<br/>

<br/>
</fmt:bundle>
<%@ include file="footer.jsp"%>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?