Commit e0e74129 authored by Bill Lynch's avatar Bill Lynch Committed by bill

Added the log viewer, othe rminor updates


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@260 b35dd754-fafc-0310-a699-88a17e54d16e
parent fc3c516b
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
<% // Title of this page and breadcrumbs <% // Title of this page and breadcrumbs
String title = "Jive Messenger Admin"; String title = "Jive Messenger Admin";
pageinfo.setTitle(title); pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "main.jsp"));
pageinfo.setPageID("server-main"); pageinfo.setPageID("server-main");
%> %>
......
<%--
- $RCSfile$
- $Revision$
- $Date$
-
- Copyright (C) 2004 Jive Software. All rights reserved.
-
- This software is published under the terms of the GNU Public License (GPL),
- a copy of which is included in this distribution.
--%>
<%@ page import="java.io.*,
java.text.SimpleDateFormat,
org.jivesoftware.messenger.user.User,
java.util.Date,
java.text.ParseException,
org.jivesoftware.messenger.auth.UnauthorizedException,
org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.Log,
org.jivesoftware.util.StringUtils"
errorPage="error.jsp"
%>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<%!
static final SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd kk:mm:ss");
private static final String parseDate(String input) {
if (input == null || "".equals(input)) {
return input;
}
if (input.length() < 19) {
return input;
}
String d = input.substring(0,19);
// try to parse it
try {
Date date = formatter.parse(d);
StringBuffer buf = new StringBuffer(input.length());
buf.append("<span class=\"date\" title=\"").append(formatter.format(date)).append("\">");
buf.append(d).append("</span>");
buf.append(input.substring(19,input.length()));
return buf.toString();
}
catch (ParseException pe) {
return input;
}
}
private static final String hilite(String input) {
if (input == null || "".equals(input)) {
return input;
}
if (input.indexOf("org.jivesoftware.") > -1) {
StringBuffer buf = new StringBuffer();
buf.append("<span class=\"hilite\">").append(input).append("</span>");
return buf.toString();
}
else if (input.startsWith(" --- ") && input.endsWith(" --- ")) {
StringBuffer buf = new StringBuffer();
buf.append("<span class=\"hilite-marker\">").append(input).append("</span>");
return buf.toString();
}
return input;
}
%>
<%
// Get parameters
String log = ParamUtils.getParameter(request,"log");
String numLinesParam = ParamUtils.getParameter(request,"lines");
int numLines = ParamUtils.getIntParameter(request,"lines",50);
String mode = ParamUtils.getParameter(request,"mode");
// Set defaults
if (log == null) {
log = "error";
}
if (mode == null) {
mode = "asc";
}
if (numLinesParam == null) {
numLinesParam = "50";
}
// Other vars
File logDir = new File(Log.getLogDirectory());
String filename = log + ".log";
File logFile = new File(logDir, filename);
BufferedReader in = new BufferedReader(new FileReader(logFile));
String line = null;
int totalNumLines = 0;
while ((line=in.readLine()) != null) {
totalNumLines++;
}
in.close();
// adjust the 'numLines' var to match totalNumLines if 'all' was passed in:
if ("All".equals(numLinesParam)) {
numLines = totalNumLines;
}
String[] lines = new String[numLines];
in = new BufferedReader(new FileReader(logFile));
// skip lines
int start = totalNumLines - numLines;
if (start < 0) { start = 0; }
for (int i=0; i<start; i++) {
in.readLine();
}
int i = 0;
if ("asc".equals(mode)) {
while ((line=in.readLine()) != null && i<numLines) {
line = StringUtils.escapeHTMLTags(line);
line = parseDate(line);
line = hilite(line);
lines[i] = line;
i++;
}
}
else {
int end = lines.length-1;
while ((line=in.readLine()) != null && i<numLines) {
line = StringUtils.escapeHTMLTags(line);
line = parseDate(line);
line = hilite(line);
lines[end-i] = line;
i++;
}
}
numLines = start + i;
%>
<html>
<head>
<title><%= log %></title>
<style type="text/css">
.log TABLE {
border : 1px #ccc solid;
}
.log TH {
font-family : verdana, arial;
font-weight : bold;
font-size : 8pt;
}
.log TR TH {
background-color : #ddd;
border-bottom : 1px #ccc solid;
padding-left : 2px;
padding-right : 2px;
text-align : left;
}
.log .head-num {
border-right : 1px #ccc solid;
}
.log TD {
font-family : courier new,monospaced;
font-size : 9pt;
background-color : #ffe;
}
.log .num {
width : 1%;
background-color : #eee !important;
border-right : 1px #ccc solid;
padding-left : 2px;
padding-right : 2px;
}
.log .line {
padding-left : 10px;
}
.hilite {
color : #900;
}
.hilite-marker {
background-color : #ff0;
color : #000;
font-weight : bold;
}
</style>
</head>
<body>
<div class="log">
<table cellpadding="1" cellspacing="0" border="0" width="100%">
<tr>
<th class="head-num">line</th>
<th>&nbsp;</th>
</tr>
<tr>
<td width="1%" nowrap class="num">
<% if ("asc".equals(mode)) { %>
<% for (int j=start+1; j<=numLines; j++) { %>
<%= j %><br>
<% } %>
<% } else { %>
<% for(int j=numLines; j>=start+1; j--) { %>
<%= j %><br>
<% } %>
<% } %>
</td>
<td width="99%" class="line">
<% for (int j=0; j<lines.length; j++) {
if (lines[j] != null) {
%>
<nobr><%= lines[j] %></nobr><br>
<% }
}
%>
</td>
</tr>
</table>
</div>
</body>
</html>
\ No newline at end of file
<%@ taglib uri="core" prefix="c"%><% <%--
/** - $RCSfile$
* $RCSfile$ - $Revision$
* $Revision$ - $Date$
* $Date$ -
*/ - Copyright (C) 2004 Jive Software. All rights reserved.
%> -
- This software is published under the terms of the GNU Public License (GPL),
- a copy of which is included in this distribution.
--%>
<%@ page import="java.io.*, <%@ page import="java.io.*,
org.jivesoftware.util.*, org.jivesoftware.util.*,
...@@ -13,25 +16,18 @@ ...@@ -13,25 +16,18 @@
org.jivesoftware.messenger.auth.UnauthorizedException, org.jivesoftware.messenger.auth.UnauthorizedException,
org.jivesoftware.messenger.JiveGlobals, org.jivesoftware.messenger.JiveGlobals,
org.jivesoftware.messenger.user.*, org.jivesoftware.messenger.user.*,
java.util.*" java.util.*,
org.jivesoftware.admin.AdminPageBean"
%> %>
<%-- Define Administration Bean --%>
<%@ taglib uri="core" prefix="c"%>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" /> <jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" />
<% admin.init(request, response, session, application, out ); %> <% admin.init(request, response, session, application, out ); %>
<!-- Define BreadCrumbs -->
<c:set var="title" value="Log Viewer" />
<c:set var="breadcrumbs" value="${admin.breadCrumbs}" />
<c:set var="log" value="${param.log}" />
<c:set target="${breadcrumbs}" property="Home" value="main.jsp" />
<c:set target="${breadcrumbs}" property="${title}" value="logviewer.jsp?log=${log}" />
<jsp:include page="top.jsp" flush="true" />
<%
String log = ParamUtils.getParameter(request, "log");
%>
<%! <%!
static final String ERROR = "error"; static final String ERROR = "error";
static final String INFO = "info"; static final String INFO = "info";
static final String WARN = "warn"; static final String WARN = "warn";
...@@ -45,198 +41,6 @@ String log = ParamUtils.getParameter(request, "log"); ...@@ -45,198 +41,6 @@ String log = ParamUtils.getParameter(request, "log");
static final String[] REFRESHES = {"None","10","30","60","90"}; static final String[] REFRESHES = {"None","10","30","60","90"};
// Days of the week
private static final String[] DAYS_OF_WEEK =
{"Sun","Mon","Tues","Wed","Thurs","Fri","Sat"};
// Months of the year
private static final String[] MONTHS_OF_YEAR =
{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug",
"Sep","Oct","Nov","Dec"};
static final SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd kk:mm");
static Map dateFormatCache = new HashMap();
static Calendar globalCal = Calendar.getInstance();
public static TimeZone getTimeZone(HttpServletRequest request, User user) {
TimeZone timeZone = JiveGlobals.getTimeZone();
String timeZoneID = null;
if (user != null) {
timeZoneID = user.getProperty("jiveTimeZoneID");
}
else if (request != null) {
Cookie cookie = getCookie(request, "jiveTimeZoneID");
if (cookie != null) {
timeZoneID = cookie.getValue();
}
}
if (timeZoneID != null) {
timeZone = TimeZone.getTimeZone(timeZoneID);
}
return timeZone;
}
public static String formatDate(HttpServletRequest request, User user, Date date) {
Locale locale = JiveGlobals.getLocale();
TimeZone timeZone = getTimeZone(request, user);
// See if the date is today.
// Check the cache of DateFormat objects:
String key = locale.toString() + timeZone.getID();
DateFormat formatter = (DateFormat)dateFormatCache.get(key);
if (formatter == null) {
formatter = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,
DateFormat.SHORT, locale);
formatter.setTimeZone(timeZone);
dateFormatCache.put(key,formatter);
}
// DateFormat objects are not thread safe, so we must synchronize on it.
synchronized(formatter) {
return formatter.format(date);
}
}
public static String dateToText(HttpServletRequest request,
User user, Date date)
{
if (date == null) {
return "";
}
// Time difference between now and the parameter object's time. Using
// the cache timer means the resolution is no better than a seconds,
// for for our purposes, we don't need better.
long delta = System.currentTimeMillis() - date.getTime();
// Within the last hour
if ((delta / JiveConstants.HOUR) < 1) {
long minutes = (delta/JiveConstants.MINUTE);
if (minutes == 0) {
return "Less than 1 min ago";
}
else if (minutes == 1) {
return "1 minute ago";
}
else {
return (minutes + " minutes ago");
}
}
// Sometime today
if ((delta / JiveConstants.DAY) < 1) {
long hours = (delta/JiveConstants.HOUR);
if(hours <= 1) {
return "1 hour ago";
}
else {
return (hours + " hours ago");
}
}
int hour = -1;
int minute = -1;
int am_pm = -1;
int day_of_month = -1;
int month = -1;
int day_of_the_week = -1;
synchronized (globalCal) {
globalCal.setTime(date);
globalCal.setTimeZone(getTimeZone(request, user));
hour = globalCal.get(Calendar.HOUR);
minute = globalCal.get(Calendar.MINUTE);
am_pm = globalCal.get(Calendar.AM_PM);
day_of_the_week = globalCal.get(Calendar.DAY_OF_WEEK);
day_of_month = globalCal.get(Calendar.DAY_OF_MONTH);
month = globalCal.get(Calendar.MONTH);
}
// Within the last week
if ((delta / JiveConstants.WEEK) < 1) {
long days = (delta/JiveConstants.DAY);
if (days <= 1) {
StringBuffer buf = new StringBuffer("Yesterday, ");
if (am_pm == 1 && hour == 0) {
buf.append(12).append(":");
} else {
buf.append(hour).append(":");
}
if (minute < 10) {
buf.append("0").append(minute);
} else {
buf.append(minute);
}
buf.append(" ");
if (am_pm == 0) {
buf.append("AM");
} else {
buf.append("PM");
}
return buf.toString();
}
else {
StringBuffer buf = new StringBuffer();
buf.append(DAYS_OF_WEEK[day_of_the_week-1]);
buf.append(", ").append(MONTHS_OF_YEAR[month]);
buf.append(" ").append(day_of_month).append(" ");
if (am_pm == 1 && hour == 0) {
buf.append(12).append(":");
} else {
buf.append(hour).append(":");
}
if (minute < 10) {
buf.append("0").append(minute);
} else {
buf.append(minute);
}
buf.append(" ");
if (am_pm == 0) {
buf.append("AM");
} else {
buf.append("PM");
}
return buf.toString();
}
}
// More than a week ago.
else {
return formatDate(request, user, date);
}
}
private static final String parseDate(HttpServletRequest request, User pageUser, String input) {
if (input == null || "".equals(input)) {
return input;
}
if (input.length() < 16) {
return input;
}
String d = input.substring(0,16);
// try to parse it
try {
Date date = formatter.parse(d);
StringBuffer buf = new StringBuffer(input.length());
buf.append("<span class=\"date\" title=\"").append(dateToText(request,pageUser,date)).append("\">");
buf.append(d).append("</span>");
buf.append(input.substring(16,input.length()));
return buf.toString();
}
catch (ParseException pe) {
return input;
}
}
private static final String hilite(HttpServletRequest request, User pageUser, String input) {
if (input == null || "".equals(input)) {
return input;
}
if (input.indexOf("org.jivesoftware.") > -1) {
StringBuffer buf = new StringBuffer();
buf.append("<span class=\"hilite\">").append(input).append("</span>");
return buf.toString();
}
return input;
}
private static HashMap parseCookie(Cookie cookie) { private static HashMap parseCookie(Cookie cookie) {
if (cookie == null || cookie.getValue() == null) { if (cookie == null || cookie.getValue() == null) {
HashMap empty = new HashMap(); HashMap empty = new HashMap();
...@@ -247,35 +51,13 @@ String log = ParamUtils.getParameter(request, "log"); ...@@ -247,35 +51,13 @@ String log = ParamUtils.getParameter(request, "log");
while (tokenizer.hasMoreTokens()) { while (tokenizer.hasMoreTokens()) {
String tok = tokenizer.nextToken(); String tok = tokenizer.nextToken();
int pos = tok.indexOf("="); int pos = tok.indexOf("=");
if (pos > 0) {
String name = tok.substring(0,pos); String name = tok.substring(0,pos);
String value = tok.substring(pos+1,tok.length()); String value = tok.substring(pos+1,tok.length());
valueMap.put(name,value); valueMap.put(name,value);
} }
return valueMap;
}
public static Cookie getCookie(HttpServletRequest request, String name) {
Cookie cookies[] = request.getCookies();
// Return null if there are no cookies or the name is invalid.
if (cookies == null || name == null || name.length() == 0) {
return null;
}
// Otherwise, we do a linear scan for the cookie.
Cookie cookie = null;
for (int i = 0; i < cookies.length; i++) {
// If the current cookie name matches the one we're looking for, we've
// found a matching cookie.
if (cookies[i].getName().equals(name)) {
cookie = cookies[i];
// The best matching cookie will be the one that has the correct
// domain name. If we've found the cookie with the correct domain name,
// return it. Otherwise, we'll keep looking for a better match.
if (request.getServerName().equals(cookie.getDomain())) {
break;
} }
} return valueMap;
}
return cookie;
} }
private static void saveCookie(HttpServletResponse response, HashMap cookie) { private static void saveCookie(HttpServletResponse response, HashMap cookie) {
...@@ -298,7 +80,7 @@ String log = ParamUtils.getParameter(request, "log"); ...@@ -298,7 +80,7 @@ String log = ParamUtils.getParameter(request, "log");
File logDir) File logDir)
{ {
// Get the cookie associated with the log files // Get the cookie associated with the log files
HashMap cookie = parseCookie(getCookie(request,"jiveforums.admin.logviewer")); HashMap cookie = parseCookie(CookieUtils.getCookie(request,"jiveforums.admin.logviewer"));
String[] logs = {"error", "info", "warn", "debug"}; String[] logs = {"error", "info", "warn", "debug"};
HashMap newCookie = new HashMap(); HashMap newCookie = new HashMap();
HashMap updates = new HashMap(); HashMap updates = new HashMap();
...@@ -313,11 +95,8 @@ String log = ParamUtils.getParameter(request, "log"); ...@@ -313,11 +95,8 @@ String log = ParamUtils.getParameter(request, "log");
catch (NumberFormatException nfe) {} catch (NumberFormatException nfe) {}
} }
// Update the size in the Map: // Update the size in the Map:
File logFile = new File(logDir, "jive." + logs[i] + ".log"); File logFile = new File(logDir, logs[i] + ".log");
long currentSize = 0; long currentSize = logFile.length();
if (logFile.exists()){
currentSize = logFile.length();
}
newCookie.put(key, ""+currentSize); newCookie.put(key, ""+currentSize);
if (currentSize != savedSize) { if (currentSize != savedSize) {
updates.put(logs[i], "true"); updates.put(logs[i], "true");
...@@ -329,26 +108,71 @@ String log = ParamUtils.getParameter(request, "log"); ...@@ -329,26 +108,71 @@ String log = ParamUtils.getParameter(request, "log");
%> %>
<% <%
// Get parameters // Get parameters
String log = ParamUtils.getParameter(request, "log");
String numLinesParam = ParamUtils.getParameter(request,"lines"); String numLinesParam = ParamUtils.getParameter(request,"lines");
int numLines = ParamUtils.getIntParameter(request,"lines",50); int numLines = ParamUtils.getIntParameter(request,"lines",50);
int refresh = ParamUtils.getIntParameter(request,"refresh",10); int refresh = ParamUtils.getIntParameter(request,"refresh",10);
String refreshParam = ParamUtils.getParameter(request,"refresh"); String refreshParam = ParamUtils.getParameter(request,"refresh");
boolean save = ParamUtils.getBooleanParameter(request,"save");
String mode = ParamUtils.getParameter(request,"mode"); String mode = ParamUtils.getParameter(request,"mode");
boolean clearLog = ParamUtils.getBooleanParameter(request,"clearLog");
boolean markLog = ParamUtils.getBooleanParameter(request,"markLog");
boolean saveLog = ParamUtils.getBooleanParameter(request,"saveLog");
boolean emailLog = ParamUtils.getBooleanParameter(request,"emailLog");
boolean debugEnabled = ParamUtils.getBooleanParameter(request,"debugEnabled"); boolean debugEnabled = ParamUtils.getBooleanParameter(request,"debugEnabled");
boolean wasDebugEnabled = ParamUtils.getBooleanParameter(request,"wasDebugEnabled"); boolean wasDebugEnabled = ParamUtils.getBooleanParameter(request,"wasDebugEnabled");
boolean debugAlert = ParamUtils.getBooleanParameter(request,"debugAlert");
// Enable/disable debugging // Enable/disable debugging
if (request.getParameter("wasDebugEnabled") != null && wasDebugEnabled != debugEnabled) { if (request.getParameter("wasDebugEnabled") != null && wasDebugEnabled != debugEnabled) {
JiveGlobals.setProperty("log.debug.enabled",String.valueOf(debugEnabled)); Log.setDebugEnabled(debugEnabled);
response.sendRedirect("logviewer.jsp?log=debug&debugAlert=true"); response.sendRedirect("logviewer.jsp?log=debug");
return; return;
} }
debugEnabled = "true".equals(JiveGlobals.getProperty("log.debug.enabled")); debugEnabled = Log.isDebugEnabled();
User pageUser = admin.getUser();
if (clearLog && log != null) {
if ("error".equals(log)) {
Log.rotateErrorLogFile();
}
else if ("warn".equals(log)) {
Log.rotateWarnLogFile();
}
else if ("info".equals(log)) {
Log.rotateInfoLogFile();
}
else if ("debug".equals(log)) {
Log.rotateDebugLogFile();
}
response.sendRedirect("logviewer.jsp?log=" + log);
return;
}
else if (markLog && log != null) {
if ("error".equals(log)) {
Log.markErrorLogFile(pageUser);
}
else if ("warn".equals(log)) {
Log.markWarnLogFile(pageUser);
}
else if ("info".equals(log)) {
Log.markInfoLogFile(pageUser);
}
else if ("debug".equals(log)) {
Log.markDebugLogFile(pageUser);
}
response.sendRedirect("logviewer.jsp?log=" + log);
return;
}
else if (saveLog && log != null) {
saveLog = false;
response.sendRedirect(request.getContextPath() + "/servlet/JiveServlet/?log=" + log);
return;
}
else if (emailLog && log != null) {
response.sendRedirect("emaillog.jsp?log=" + log);
return;
}
// Set defaults // Set defaults
if (log == null) { if (log == null) {
...@@ -363,65 +187,22 @@ String log = ParamUtils.getParameter(request, "log"); ...@@ -363,65 +187,22 @@ String log = ParamUtils.getParameter(request, "log");
// Other vars // Other vars
File logDir = new File(Log.getLogDirectory()); File logDir = new File(Log.getLogDirectory());
String filename = "jive." + log + ".log"; String filename = log + ".log";
File logFile = new File(logDir, filename); File logFile = new File(logDir, filename);
boolean tooBig = false;
if (logFile.exists()){
tooBig = (logFile.length() / (1024)) > 250;
}
// Determine if any of the log files contents have been updated: // Determine if any of the log files contents have been updated:
HashMap newlogs = getLogUpdate(request, response, logDir); HashMap newlogs = getLogUpdate(request, response, logDir);
String line = null;
int totalNumLines = 0;
if (logFile.exists()){
BufferedReader in = new BufferedReader(new FileReader(logFile));
while ((line=in.readLine()) != null) {
totalNumLines++;
}
in.close();
// adjust the 'numLines' var to match totalNumLines if 'all' was passed in:
if ("All".equals(numLinesParam)) {
numLines = totalNumLines;
}
}
else {
numLines = 0;
}
String[] lines = new String[numLines];
int start = totalNumLines - numLines;
if (logFile.exists()){
BufferedReader in = new BufferedReader(new FileReader(logFile));
// skip lines
if (start < 0) { start = 0; }
for (int j=0; j<start; j++) {
in.readLine();
}
int i = 0;
if (ASCENDING.equals(mode)) {
while ((line=in.readLine()) != null && i<numLines) {
line = parseDate(request, admin.getUser(), line);
line = hilite(request, admin.getUser(), line);
lines[i] = line;
i++;
}
}
else {
int end = lines.length-1;
while ((line=in.readLine()) != null && i<numLines) {
line = parseDate(request, admin.getUser(), line);
line = hilite(request, admin.getUser(), line);
lines[end-i] = line;
i++;
}
}
numLines = start + i;
}
%> %>
<%@ include file="header.jsp" %> <% // Title of this page and breadcrumbs
String title = "Log Viewer";
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "main.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "logviewer.jsp?log=" + log));
pageinfo.setPageID("server-logs");
%>
<jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<% if (refreshParam != null && !"None".equals(refreshParam)) { %> <% if (refreshParam != null && !"None".equals(refreshParam)) { %>
...@@ -429,65 +210,12 @@ String log = ParamUtils.getParameter(request, "log"); ...@@ -429,65 +210,12 @@ String log = ParamUtils.getParameter(request, "log");
<% } %> <% } %>
<% if (debugAlert) { %> <div id="logviewer">
<script language="JavaScript" type="text/javascript">
alert('Your change to the debug logging will go into affect after you restart your appserver.');
</script>
<% } %>
<style type="text/css"> <style type="text/css">
.log TABLE { SELECT, INPUT {
border : 1px #ccc solid;
}
.log TH {
font-family : verdana, arial;
font-weight : bold;
font-size : 0.7em;
}
.log TR TH {
background-color : #ddd;
border-bottom : 1px #ccc solid;
padding-left : 2px;
padding-right : 2px;
text-align : left;
}
.log .head-num {
border-right : 1px #ccc solid;
}
.log TD {
font-family : courier new;
font-size : 0.75em;
background-color : #ffe;
}
.log .num {
width : 1%;
background-color : #eee !important;
border-right : 1px #ccc solid;
padding-left : 2px;
padding-right : 2px;
}
.log .line {
padding-left : 10px;
}
.container {
border-width : 0px 1px 1px 1px;
border-color : #ccc;
border-style : solid;
}
.info TD {
font-family : verdana, arial; font-family : verdana, arial;
font-size : 0.7em; font-size : 8pt;
}
SELECT {
font-family : verdana, arial;
font-size : 0.8em;
}
.info .label {
padding-right : 6px;
} }
.date { .date {
color : #00f; color : #00f;
...@@ -495,90 +223,100 @@ SELECT { ...@@ -495,90 +223,100 @@ SELECT {
border-style : dotted; border-style : dotted;
border-color : #00f; border-color : #00f;
} }
.new { .buttons TD {
font-family : courier new; padding : 3px;
font-weight : bold;
color : #600;
} }
.hilite { .buttons .icon-label {
color : #900; padding-right : 1em;
}
.log-info {
border-width : 0px 1px 1px 1px;
border-color : #ccc;
border-style : solid;
}
IFRAME {
border : 1px #666 solid;
} }
</style> </style>
<br> <form action="logviewer.jsp" name="logViewer" method="get">
<form action="logviewer.jsp">
<input type="hidden" name="log" value="<%= log %>"> <input type="hidden" name="log" value="<%= log %>">
<table class="jive-tabs" cellpadding="0" cellspacing="0" border="0"> <div class="jive-tabs">
<tr> <table cellpadding="0" cellspacing="0" border="0" width="100%">
<td class="jive-tab-spacer" width="1%"><img src="images/blank.gif" width="5" height="1" border="0"></td> <tbody>
<td class="jive-<%= (("error".equals(log))?"selected-":"") %>tab" width="1%" nowrap> <tr>
<td class="jive-spacer" width="1%">&nbsp;</td>
<td class="jive-tab<%= (("error".equals(log))?"-active":"") %>" width="1%">
<a href="logviewer.jsp?log=error" <a href="logviewer.jsp?log=error"
>Error</a> >Error</a>
<span class="new"> <span class="new">
<%= ((newlogs.containsKey("error"))?"*":"") %> <%= ((newlogs.containsKey("error"))?"*":"") %>
</span> </span>
</td> </td>
<td class="jive-tab-spacer" width="1%"><img src="images/blank.gif" width="5" height="1" border="0"></td> <td class="jive-spacer" width="1%">&nbsp;</td>
<td class="jive-<%= (("info".equals(log))?"selected-":"") %>tab" width="1%" nowrap> <td class="jive-tab<%= (("warn".equals(log))?"-active":"") %>" width="1%">
<a href="logviewer.jsp?log=info"
>Info</a>
<span class="new">
<%= ((newlogs.containsKey("info"))?"*":"") %>
</span>
</td>
<td class="jive-tab-spacer" width="1%"><img src="images/blank.gif" width="5" height="1" border="0"></td>
<td class="jive-<%= (("warn".equals(log))?"selected-":"") %>tab" width="1%" nowrap>
<a href="logviewer.jsp?log=warn" <a href="logviewer.jsp?log=warn"
>Warn</a> >Warn</a>
<span class="new"> <span class="new">
<%= ((newlogs.containsKey("warn"))?"*":"") %> <%= ((newlogs.containsKey("warn"))?"*":"") %>
</span> </span>
</td> </td>
<td class="jive-tab-spacer" width="1%"><img src="images/blank.gif" width="5" height="1" border="0"></td> <td class="jive-spacer" width="1%">&nbsp;</td>
<td class="jive-<%= (("debug".equals(log))?"selected-":"") %>tab" width="1%" nowrap> <td class="jive-tab<%= (("info".equals(log))?"-active":"") %>" width="1%">
<a href="logviewer.jsp?log=info"
>Info</a>
<span class="new">
<%= ((newlogs.containsKey("info"))?"*":"") %>
</span>
</td>
<td class="jive-spacer" width="1%">&nbsp;</td>
<td class="jive-tab<%= (("debug".equals(log))?"-active":"") %>" width="1%">
<a href="logviewer.jsp?log=debug" <a href="logviewer.jsp?log=debug"
>Debug</a> >Debug</a>
<span class="new"> <span class="new">
<%= ((newlogs.containsKey("debug"))?"*":"") %> <%= ((newlogs.containsKey("debug"))?"*":"") %>
</span> </span>
</td> </td>
<td class="jive-tab-spring" width="92%" align="right" nowrap> <td class="jive-stretch" width="92%" align="right" nowrap>
&nbsp; &nbsp;
</td> </td>
</tr> </tr>
</tbody>
</table> </table>
<table class="container" cellpadding="6" cellspacing="0" border="0" width="100%">
<tr><td>
<span class="info"> <% ByteFormat byteFormatter = new ByteFormat();
<table cellpadding="2" cellspacing="0" border="0" width="100%"> Date lastMod = new Date(logFile.lastModified());
<tr><td colspan="5"><img src="images/blank.gif" width="1" height="4" border="0"></td></tr> DateFormat dateFormatter = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
%>
<div class="log-info">
<table cellpadding="6" cellspacing="0" border="0" width="100%">
<tbody>
<tr> <tr>
<td class="label" width="1%">Filename:</td> <td>
<td width="1%" nowrap><b><%= logFile.getName() %></b></td> <table cellpadding="3" cellspacing="0" border="0" width="100%">
<td rowspan="3" width="96%">&nbsp;</td> <tr>
<td class="label" width="1%">Order:</td> <td nowrap>Log File:</td>
<td width="1%" nowrap> <td nowrap><b><%= logFile.getName() %></b> (<%= byteFormatter.format(logFile.length()) %>)</td>
<input type="radio" name="mode" value="desc"<%= ("desc".equals(mode)?" checked":"") %> <td width="96%" rowspan="3">&nbsp;</td>
onclick="this.form.submit();" <td nowrap>Order:</td>
id="rb01" <td nowrap>
> <label for="rb01">Newest at top</label>
<input type="radio" name="mode" value="asc"<%= ("asc".equals(mode)?" checked":"") %> <input type="radio" name="mode" value="asc"<%= ("asc".equals(mode)?" checked":"") %>
onclick="this.form.submit();" onclick="this.form.submit();" id="rb01"
id="rb02" ><label for="rb01">Normal</label>
> <label for="rb02">Newest at bottom</label> <input type="radio" name="mode" value="desc"<%= ("desc".equals(mode)?" checked":"") %>
onclick="this.form.submit();" id="rb02"
><label for="rb02">Reverse</label>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="label" width="1%" nowrap>Last Modified:</td> <td nowrap>Last Modified:</td>
<% Date lastMod = new Date(logFile.lastModified()); <td nowrap>
DateFormat dateFormatter = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT); <span><%= dateFormatter.format(lastMod) %></span>
%> </td>
<td width="1%" nowrap><span title"<%= dateToText(request, admin.getUser(), lastMod) %>"><%= dateFormatter.format(lastMod) %></span></td> <td nowrap>Lines:</td>
<td class="label" width="1%">Lines:</td> <td nowrap>
<td width="1%" nowrap>
<select name="lines" size="1" <select name="lines" size="1"
onchange="this.form.submit();"> onchange="this.form.submit();">
<% for (int j=0; j<LINES.length; j++) { <% for (int j=0; j<LINES.length; j++) {
...@@ -587,19 +325,55 @@ SELECT { ...@@ -587,19 +325,55 @@ SELECT {
<option value="<%= LINES[j] %>"<%= selected %>><%= LINES[j] %> <option value="<%= LINES[j] %>"<%= selected %>><%= LINES[j] %>
<% } %> <% } %>
<% if (!tooBig) { %>
<option value="All"<%= (("All".equals(numLinesParam))?" selected":"") %> <option value="All"<%= (("All".equals(numLinesParam))?" selected":"") %>
>All >All
<% } %>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="label" width="1%">Size:</td> <td colspan="2">
<% ByteFormat byteFormatter = new ByteFormat(); %> <script language="JavaScript" type="text/javascript">
<td width="1%" nowrap><%= byteFormatter.format(logFile.length()) %></td> <!--
<td class="label" width="1%">Refresh:</td> function setLog(log) {
<td width="1%" nowrap> document.logViewer.clearLog.value = 'false';
document.logViewer.markLog.value = 'false';
document.logViewer.saveLog.value = 'false';
document.logViewer.emailLog.value = 'false';
var t = eval("document.logViewer." + log);
t.value = 'true';
}
// -->
</script>
<input type="hidden" name="clearLog" value="false">
<input type="hidden" name="markLog" value="false">
<input type="hidden" name="saveLog" value="false">
<input type="hidden" name="emailLog" value="false">
<div class="buttons">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td class="icon">
<a href="#" onclick="if (confirm('Are you sure you want to clear this log file?')) {setLog('clearLog'); document.logViewer.submit(); return true;} else { return false; }"><img src="images/delete-16x16.gif" border="0" alt="Clear Log"></a>
</td>
<td class="icon-label">
<a href="#" onclick="if (confirm('Are you sure you want to clear this log file?')) {setLog('clearLog'); document.logViewer.submit(); return true;} else { return false; }"
>Clear</a>
</td>
<td class="icon">
<a href="#" onclick="setLog('markLog'); document.logViewer.submit(); return true;"><img src="images/mark-16x16.gif" border="0" alt="Mark Log"></a>
</td>
<td class="icon-label">
<a href="#" onclick="setLog('markLog'); document.logViewer.submit(); return true;"
>Mark</a>
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td nowrap>Refresh:</td>
<td nowrap>
<select size="1" name="refresh" onchange="this.form.submit();"> <select size="1" name="refresh" onchange="this.form.submit();">
<% for (int j=0; j<REFRESHES.length; j++) { <% for (int j=0; j<REFRESHES.length; j++) {
String selected = REFRESHES[j].equals(refreshParam)?" selected":""; String selected = REFRESHES[j].equals(refreshParam)?" selected":"";
...@@ -612,72 +386,61 @@ SELECT { ...@@ -612,72 +386,61 @@ SELECT {
</td> </td>
</tr> </tr>
<% // Print out a special switch to enable/disable debugging <% if ("debug".equals(log)) { %>
if ("debug".equals(log)) {
%>
<input type="hidden" name="wasDebugEnabled" value="<%= debugEnabled %>">
<tr valign="top">
<td class="label" width="1%">Debugging Enabled:</td>
<td width="1%" nowrap>
<input type="radio" name="debugEnabled" value="true"<%= ((debugEnabled) ? " checked" : "") %> id="de01"> <tr>
<label for="de01">Enabled</label> <td colspan="5">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td width="1%" nowrap>
Debug Log: &nbsp;
</td>
<td width="1%">
<input type="radio" name="debugEnabled" value="true"<%= ((debugEnabled) ? " checked" : "") %> id="de01">
</td>
<td width="1%" nowrap>
<label for="de01">Enabled</label> &nbsp;
</td>
<td width="1%">
<input type="radio" name="debugEnabled" value="false"<%= ((!debugEnabled) ? " checked" : "") %> id="de02"> <input type="radio" name="debugEnabled" value="false"<%= ((!debugEnabled) ? " checked" : "") %> id="de02">
<label for="de02">Disabled</label> </td>
<td width="1%" nowrap>
(change requires restart) <label for="de02">Disabled</label> &nbsp;
</td>
<br> <td width="1%">
<input type="hidden" name="wasDebugEnabled" value="<%= debugEnabled %>">
<input type="submit" name="" value="Update"> <input type="submit" name="" value="Update">
</td> </td>
<td colspan="3">&nbsp;</td> <td width="94%">&nbsp;</td>
</tr>
</table>
</td>
</tr> </tr>
<% } %> <% } %>
<tr><td colspan="5"><img src="images/blank.gif" width="1" height="8" border="0"></td></tr>
</table> </table>
</span> </div>
</td>
</td></tr> </tr>
</tbody>
</table> </table>
</div>
<br> <br>
<span class="log"> <span class="jive-description" style="color:#666;">
<table cellpadding="1" cellspacing="0" border="0" width="100%"> Log dir: <%= JiveGlobals.getMessengerHome() %><%= File.separator %>logs
<tr>
<th class="head-num">line</th>
<th>message</th>
</tr>
<tr>
<td width="1%" nowrap class="num">
<% if (ASCENDING.equals(mode)) { %>
<% for (int j=start+1; j<=numLines; j++) { %>
<%= j %><br>
<% } %>
<% } else { %>
<% for(int j=numLines; j>=start+1; j--) { %>
<%= j %><br>
<% } %>
<% } %>
</td>
<td width="99%" class="line">
<% for (int j=0; j<lines.length; j++) {
if (lines[j] != null) {
%>
<nobr><%= lines[j] %></nobr><br>
<% }
}
%>
</td>
</tr>
</table>
</span> </span>
<br><br>
<iframe src="log.jsp?log=<%= log %>&mode=<%= mode %>&lines=<%= ("All".equals(numLinesParam) ? "All" : String.valueOf(numLines)) %>"
frameborder="0" height="400" width="100%" marginheight="0" marginwidth="0" scrolling="auto"></iframe>
</form> </form>
</div>
<jsp:include page="bottom.jsp" flush="true" /> <jsp:include page="bottom.jsp" flush="true" />
\ No newline at end of file
<%@ taglib uri="core" prefix="c"%>
<%@ taglib uri="fmt" prefix="fmt" %>
<%-- <%--
- $RCSfile$ - $RCSfile$
- $Revision$ - $Revision$
- $Date$ - $Date$
-
- Copyright (C) 2004 Jive Software. All rights reserved.
-
- This software is published under the terms of the GNU Public License (GPL),
- a copy of which is included in this distribution.
--%> --%>
<%@ page import="org.jivesoftware.util.*, <%@ page import="org.jivesoftware.util.*,
org.jivesoftware.messenger.XMPPServerInfo, org.jivesoftware.messenger.XMPPServerInfo,
java.util.Iterator, java.util.Iterator,
org.jivesoftware.messenger.ServerPort" org.jivesoftware.messenger.ServerPort,
org.jivesoftware.admin.AdminPageBean"
%> %>
<%@ taglib uri="core" prefix="c" %>
<%@ taglib uri="fmt" prefix="fmt" %>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<%-- Define Administration Bean --%> <%-- Define Administration Bean --%>
<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" /> <jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" />
<% admin.init(request, response, session, application, out ); %> <% admin.init(request, response, session, application, out ); %>
<c:set var="admin" value="${admin.manager}" /> <c:set var="admin" value="${admin.manager}" />
<!-- Define Title and BreadCrumbs --> <% // Title of this page and breadcrumbs
<c:set var="title" value="Server Properties" /> String title = "Server Properties";
<c:set var="breadcrumbs" value="${admin.breadCrumbs}" /> pageinfo.setTitle(title);
<c:set target="${breadcrumbs}" property="Home" value="main.jsp" /> pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "main.jsp"));
<c:set target="${breadcrumbs}" property="${title}" value="server-props.jsp" /> pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "server-props.jsp"));
pageinfo.setPageID("server-props");
%>
<jsp:include page="top.jsp" flush="true" /> <jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<p> <p>
Below is a list of information for this <fmt:message key="short.title" bundle="${lang}" /> server. Below is a list of information for this <fmt:message key="short.title" bundle="${lang}" /> server.
......
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
- $RCSfile$ - $RCSfile$
- $Revision$ - $Revision$
- $Date$ - $Date$
-
- Copyright (C) 2004 Jive Software. All rights reserved.
-
- This software is published under the terms of the GNU Public License (GPL),
- a copy of which is included in this distribution.
--%> --%>
<%@ page import="org.jivesoftware.util.*, <%@ page import="org.jivesoftware.util.*,
...@@ -10,23 +15,28 @@ ...@@ -10,23 +15,28 @@
org.jivesoftware.messenger.XMPPServer, org.jivesoftware.messenger.XMPPServer,
org.jivesoftware.messenger.container.*, org.jivesoftware.messenger.container.*,
org.jivesoftware.messenger.spi.BasicServer, org.jivesoftware.messenger.spi.BasicServer,
org.jivesoftware.messenger.auth.UnauthorizedException" org.jivesoftware.messenger.auth.UnauthorizedException,
org.jivesoftware.admin.AdminPageBean"
%> %>
<%@ taglib uri="core" prefix="c" %> <%@ taglib uri="core" prefix="c" %>
<%@ taglib uri="fmt" prefix="ftm" %> <%@ taglib uri="fmt" prefix="fmt" %>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<%-- Define Administration Bean --%> <%-- Define Administration Bean --%>
<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" /> <jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" />
<% admin.init(request, response, session, application, out ); %> <% admin.init(request, response, session, application, out ); %>
<!-- Define Title and BreadCrumbs --> <% // Title of this page and breadcrumbs
<c:set var="title" value="Server Status" /> String title = "Server Status";
<c:set var="breadcrumbs" value="${admin.breadCrumbs}" /> pageinfo.setTitle(title);
<c:set target="${breadcrumbs}" property="Home" value="main.jsp" /> pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "main.jsp"));
<c:set target="${breadcrumbs}" property="${title}" value="server-status.jsp" /> pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "server-status.jsp"));
pageinfo.setPageID("server-status");
%>
<jsp:include page="top.jsp" flush="true" /> <jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<% // Get parameters // <% // Get parameters //
boolean stop = request.getParameter("stop") != null; boolean stop = request.getParameter("stop") != null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment