1 <%@ page import="org.ultramonkey.l7.model.*,
2 org.ultramonkey.l7.controller.*,
3 org.ultramonkey.l7.view.*, java.util.*,
4 java.text.SimpleDateFormat,java.text.NumberFormat"
5 language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
10 if (session.isNew()) {
11 MessageView error = new MessageView(41255, LogCategorySet.GUI_USER_AUTHENTICATION, Message.INVALID_SESSSION);
12 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
13 response.sendRedirect(RedirectPages.LOGIN);
20 MessageView message = (MessageView) session.getAttribute(SessionKeys.RESULT_MESSAGE);
21 String errorMessage = "";
24 String resultJudge = "success";
25 if (message != null) {
26 errorMessage = message.getMessage();
27 errorNumber = message.getErrno();
28 category = message.getCategory();
29 session.setAttribute(SessionKeys.RESULT_MESSAGE, null);
30 if ( errorNumber >= ErrNo.ERRORNUMBER )
31 resultJudge = "error";
37 MessageView commandmessage = (MessageView) session.getAttribute(SessionKeys.COMMAND_MESSAGE);
38 String commandMessage = "";
39 int commandNumber = 0;
40 String commandCategory = "";
41 String commandJudge = "success";
42 if (commandmessage != null) {
43 commandMessage = commandmessage.getMessage();
44 commandNumber = commandmessage.getErrno();
45 commandCategory = commandmessage.getCategory();
46 session.setAttribute(SessionKeys.COMMAND_MESSAGE, null);
47 if ( commandNumber >= ErrNo.ERRORNUMBER )
48 commandJudge = "error";
54 L7guiFramework framework = new L7guiFramework();
55 LogData logdata = framework.getLogData();
58 MessageView error = new MessageView(41256, LogCategorySet.GUI_LOG, Message.UNEXPECTED_ERROR);
59 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
60 response.sendRedirect(RedirectPages.LOGIN);
64 LogSet data = logdata.admLog;
67 MessageView error = new MessageView(41257, LogCategorySet.GUI_LOG, Message.UNEXPECTED_ERROR);
68 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
69 response.sendRedirect(RedirectPages.LOGIN);
73 Vector<LogFileData> logfiles = data.logFiles;
74 if (logfiles == null){
75 MessageView error = new MessageView(41258, LogCategorySet.GUI_LOG, Message.UNEXPECTED_ERROR);
76 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
77 response.sendRedirect(RedirectPages.LOGIN);
81 HashMap<LogData.LogCategory, LogData.LogLevel> logcategoryset = data.logLevel;
82 if (logcategoryset == null){
83 MessageView error = new MessageView(41259, LogCategorySet.GUI_LOG, Message.UNEXPECTED_ERROR);
84 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
85 response.sendRedirect(RedirectPages.LOGIN);
92 ClusterData cd = framework.getClusterData();
95 MessageView error = new MessageView(41260, LogCategorySet.GUI_IO_COMMAND, Message.CLUSTER_DATA_ERROR);
96 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
97 response.sendRedirect(RedirectPages.LOGIN);
103 String cssSeat = "l7gui_single_style.css";
104 if ( cd.self_status == ClusterStatus.ACTIVE ){
105 cssSeat = "l7gui_act_style.css";
107 else if ( cd.self_status == ClusterStatus.STANDBY ){
108 cssSeat = "l7gui_sby_style.css";
114 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
118 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
119 <meta http-equiv="Pragma" content="no-cache">
120 <meta http-equiv="Cache-Control" content="no-cache">
121 <meta http-equiv="Expires" content="0">
122 <meta http-equiv="Content-Script-Type" content="text/javascript" />
123 <meta http-equiv="Content-Style-Type" content="text/css" />
124 <script src="l7gui.js" type="text/javascript"></script>
126 <meta http-equiv="refresh" content="<%= RedirectPages.NOSCRIPT_TIME %>; url=<%= RedirectPages.LOGIN %>"/>
128 <link rel="stylesheet" type="text/css" href="<%=cssSeat %>" />
129 <link rel="shortcut icon" href="images/favicon.ico"/>
130 <title>Log - Admin command (l7vsadm) -</title>
134 <body class="normal">
135 <jsp:include page="menu.jsp" flush="false"/>
139 <h1>Log - Admin command (l7vsadm) -</h1>
141 if ( (message != null ) && (errorMessage != null) ) {
144 <p class="<%=resultJudge %>">[<%=category%>-<%=errorNumber%>]</p>
145 <p class="<%=resultJudge %>"><%=errorMessage%></p>
148 } else if ( (commandmessage != null) && (commandMessage != null) ) {
150 <p class="<%=commandJudge %>">[<%=commandCategory%>-<%=commandNumber%>]</p>
151 <p class="<%=commandJudge %>"><%=commandMessage%></p>
156 <h2> Download Log File</h2>
157 <h4>Please select the following list you would like to download the log file. </h4>
158 <table class="infotable" cellspacing="0">
161 <th>LogFileName</th><th>LastUpdate</th><th>FileSize(byte)</th>
165 SimpleDateFormat dfm = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
166 NumberFormat num = NumberFormat.getInstance();
167 Iterator<LogFileData> i = logfiles.iterator();
169 while ( i.hasNext() ){
170 LogFileData log = (LogFileData) i.next();
172 if ( log != null && log.fileName != null){
175 out.println("<a href=\"LogOutputServlet?type=" + LogCategorySet.L7VSADM + "&log=" + log.fileName + "\">" + log.fileName + "</a>");
176 out.println("</td>");
177 out.println("<td class=\"center\">" + dfm.format(log.time) + "</td>");
178 out.println("<td class=\"right\">" + num.format(log.size) + "</td>");
179 out.println("</tr>");
187 <h2>Change Log Level</h2>
188 <h4>Please select log level you would like to change.</h4>
190 <form method="post" action="LogLevelServlet" name="log_adm">
191 <input type="hidden" name="type" value="<%=LogCategorySet.L7VSADM %>">
192 <table class="infotable" cellspacing="0">
195 <th>Category</th><th>Level</th>
198 TreeSet<LogData.LogCategory> tree = new TreeSet<LogData.LogCategory>(logcategoryset.keySet());
199 Iterator<LogData.LogCategory> it = tree.iterator();
201 while (it.hasNext()) {
202 LogData.LogCategory logcategory = (LogData.LogCategory) it.next();
204 if (logcategory != null){
207 <td><%= logcategory %></td>
209 <select id="<%= logcategory %>" name="<%= logcategory %>">
210 <option value="<%=LogData.LogLevel.NONE %>"<%
211 if ( logcategoryset.get(logcategory) == LogData.LogLevel.NONE)
212 out.print(" selected");
214 <option value="<%=LogData.LogLevel.INFO %>"<%
215 if ( logcategoryset.get(logcategory) == (LogData.LogLevel.INFO)){
216 out.print(" selected");
219 <option value="<%=LogData.LogLevel.DEBUG %>"<%
220 if ( logcategoryset.get(logcategory) == (LogData.LogLevel.DEBUG)) {
221 out.print(" selected");
224 <option value="<%=LogData.LogLevel.ERROR %>"<%
225 if (logcategoryset.get(logcategory) == (LogData.LogLevel.ERROR)){
226 out.print(" selected");
229 <option value="<%=LogData.LogLevel.WARN %>"<%
230 if ( logcategoryset.get(logcategory) == (LogData.LogLevel.WARN)){
231 out.print(" selected");
234 <option value="<%=LogData.LogLevel.FATAL %>"<%
235 if ( logcategoryset.get(logcategory) == (LogData.LogLevel.FATAL)){
236 out.print(" selected");
249 <input type="submit" name="button" value="<%= ButtonMode.SAVE %>" onClick="return confirm(log_adm_save)" />
251 if (cd.self_status == ClusterStatus.ACTIVE || cd.self_status == ClusterStatus.STANDBY) {
253 <input type="submit" name="button" value="<%= ButtonMode.SAVESYNC %>" onClick="return confirm(log_adm_savesync)" />