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 @@
<% // Title of this page and breadcrumbs
String title = "Jive Messenger Admin";
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "main.jsp"));
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$
* $Revision$
* $Date$
*/
%>
<%--
- $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.*,
org.jivesoftware.util.*,
......@@ -13,25 +16,18 @@
org.jivesoftware.messenger.auth.UnauthorizedException,
org.jivesoftware.messenger.JiveGlobals,
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" />
<% 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 INFO = "info";
static final String WARN = "warn";
......@@ -45,198 +41,6 @@ String log = ParamUtils.getParameter(request, "log");
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) {
if (cookie == null || cookie.getValue() == null) {
HashMap empty = new HashMap();
......@@ -247,35 +51,13 @@ String log = ParamUtils.getParameter(request, "log");
while (tokenizer.hasMoreTokens()) {
String tok = tokenizer.nextToken();
int pos = tok.indexOf("=");
if (pos > 0) {
String name = tok.substring(0,pos);
String value = tok.substring(pos+1,tok.length());
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 cookie;
return valueMap;
}
private static void saveCookie(HttpServletResponse response, HashMap cookie) {
......@@ -298,7 +80,7 @@ String log = ParamUtils.getParameter(request, "log");
File logDir)
{
// 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"};
HashMap newCookie = new HashMap();
HashMap updates = new HashMap();
......@@ -313,11 +95,8 @@ String log = ParamUtils.getParameter(request, "log");
catch (NumberFormatException nfe) {}
}
// Update the size in the Map:
File logFile = new File(logDir, "jive." + logs[i] + ".log");
long currentSize = 0;
if (logFile.exists()){
currentSize = logFile.length();
}
File logFile = new File(logDir, logs[i] + ".log");
long currentSize = logFile.length();
newCookie.put(key, ""+currentSize);
if (currentSize != savedSize) {
updates.put(logs[i], "true");
......@@ -329,26 +108,71 @@ String log = ParamUtils.getParameter(request, "log");
%>
<%
// Get parameters
String log = ParamUtils.getParameter(request, "log");
String numLinesParam = ParamUtils.getParameter(request,"lines");
int numLines = ParamUtils.getIntParameter(request,"lines",50);
int refresh = ParamUtils.getIntParameter(request,"refresh",10);
String refreshParam = ParamUtils.getParameter(request,"refresh");
boolean save = ParamUtils.getBooleanParameter(request,"save");
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 wasDebugEnabled = ParamUtils.getBooleanParameter(request,"wasDebugEnabled");
boolean debugAlert = ParamUtils.getBooleanParameter(request,"debugAlert");
// Enable/disable debugging
if (request.getParameter("wasDebugEnabled") != null && wasDebugEnabled != debugEnabled) {
JiveGlobals.setProperty("log.debug.enabled",String.valueOf(debugEnabled));
response.sendRedirect("logviewer.jsp?log=debug&debugAlert=true");
Log.setDebugEnabled(debugEnabled);
response.sendRedirect("logviewer.jsp?log=debug");
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
if (log == null) {
......@@ -363,65 +187,22 @@ String log = ParamUtils.getParameter(request, "log");
// Other vars
File logDir = new File(Log.getLogDirectory());
String filename = "jive." + log + ".log";
String filename = log + ".log";
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:
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)) { %>
......@@ -429,65 +210,12 @@ String log = ParamUtils.getParameter(request, "log");
<% } %>
<% if (debugAlert) { %>
<script language="JavaScript" type="text/javascript">
alert('Your change to the debug logging will go into affect after you restart your appserver.');
</script>
<% } %>
<div id="logviewer">
<style type="text/css">
.log TABLE {
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 {
SELECT, INPUT {
font-family : verdana, arial;
font-size : 0.7em;
}
SELECT {
font-family : verdana, arial;
font-size : 0.8em;
}
.info .label {
padding-right : 6px;
font-size : 8pt;
}
.date {
color : #00f;
......@@ -495,90 +223,100 @@ SELECT {
border-style : dotted;
border-color : #00f;
}
.new {
font-family : courier new;
font-weight : bold;
color : #600;
.buttons TD {
padding : 3px;
}
.hilite {
color : #900;
.buttons .icon-label {
padding-right : 1em;
}
.log-info {
border-width : 0px 1px 1px 1px;
border-color : #ccc;
border-style : solid;
}
IFRAME {
border : 1px #666 solid;
}
</style>
<br>
<form action="logviewer.jsp">
<form action="logviewer.jsp" name="logViewer" method="get">
<input type="hidden" name="log" value="<%= log %>">
<table class="jive-tabs" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="jive-tab-spacer" width="1%"><img src="images/blank.gif" width="5" height="1" border="0"></td>
<td class="jive-<%= (("error".equals(log))?"selected-":"") %>tab" width="1%" nowrap>
<div class="jive-tabs">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody>
<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"
>Error</a>
<span class="new">
<%= ((newlogs.containsKey("error"))?"*":"") %>
</span>
</td>
<td class="jive-tab-spacer" width="1%"><img src="images/blank.gif" width="5" height="1" border="0"></td>
<td class="jive-<%= (("info".equals(log))?"selected-":"") %>tab" width="1%" nowrap>
<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>
<td class="jive-spacer" width="1%">&nbsp;</td>
<td class="jive-tab<%= (("warn".equals(log))?"-active":"") %>" width="1%">
<a href="logviewer.jsp?log=warn"
>Warn</a>
<span class="new">
<%= ((newlogs.containsKey("warn"))?"*":"") %>
</span>
</td>
<td class="jive-tab-spacer" width="1%"><img src="images/blank.gif" width="5" height="1" border="0"></td>
<td class="jive-<%= (("debug".equals(log))?"selected-":"") %>tab" width="1%" nowrap>
<td class="jive-spacer" width="1%">&nbsp;</td>
<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"
>Debug</a>
<span class="new">
<%= ((newlogs.containsKey("debug"))?"*":"") %>
</span>
</td>
<td class="jive-tab-spring" width="92%" align="right" nowrap>
<td class="jive-stretch" width="92%" align="right" nowrap>
&nbsp;
</td>
</tr>
</tr>
</tbody>
</table>
<table class="container" cellpadding="6" cellspacing="0" border="0" width="100%">
<tr><td>
<span class="info">
<table cellpadding="2" cellspacing="0" border="0" width="100%">
<tr><td colspan="5"><img src="images/blank.gif" width="1" height="4" border="0"></td></tr>
<% ByteFormat byteFormatter = new ByteFormat();
Date lastMod = new Date(logFile.lastModified());
DateFormat dateFormatter = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
%>
<div class="log-info">
<table cellpadding="6" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td class="label" width="1%">Filename:</td>
<td width="1%" nowrap><b><%= logFile.getName() %></b></td>
<td rowspan="3" width="96%">&nbsp;</td>
<td class="label" width="1%">Order:</td>
<td width="1%" nowrap>
<input type="radio" name="mode" value="desc"<%= ("desc".equals(mode)?" checked":"") %>
onclick="this.form.submit();"
id="rb01"
> <label for="rb01">Newest at top</label>
<td>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tr>
<td nowrap>Log File:</td>
<td nowrap><b><%= logFile.getName() %></b> (<%= byteFormatter.format(logFile.length()) %>)</td>
<td width="96%" rowspan="3">&nbsp;</td>
<td nowrap>Order:</td>
<td nowrap>
<input type="radio" name="mode" value="asc"<%= ("asc".equals(mode)?" checked":"") %>
onclick="this.form.submit();"
id="rb02"
> <label for="rb02">Newest at bottom</label>
onclick="this.form.submit();" id="rb01"
><label for="rb01">Normal</label>
<input type="radio" name="mode" value="desc"<%= ("desc".equals(mode)?" checked":"") %>
onclick="this.form.submit();" id="rb02"
><label for="rb02">Reverse</label>
</td>
</tr>
<tr>
<td class="label" width="1%" nowrap>Last Modified:</td>
<% Date lastMod = new Date(logFile.lastModified());
DateFormat dateFormatter = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);
%>
<td width="1%" nowrap><span title"<%= dateToText(request, admin.getUser(), lastMod) %>"><%= dateFormatter.format(lastMod) %></span></td>
<td class="label" width="1%">Lines:</td>
<td width="1%" nowrap>
<td nowrap>Last Modified:</td>
<td nowrap>
<span><%= dateFormatter.format(lastMod) %></span>
</td>
<td nowrap>Lines:</td>
<td nowrap>
<select name="lines" size="1"
onchange="this.form.submit();">
<% for (int j=0; j<LINES.length; j++) {
......@@ -587,19 +325,55 @@ SELECT {
<option value="<%= LINES[j] %>"<%= selected %>><%= LINES[j] %>
<% } %>
<% if (!tooBig) { %>
<option value="All"<%= (("All".equals(numLinesParam))?" selected":"") %>
>All
<% } %>
</select>
</td>
</tr>
<tr>
<td class="label" width="1%">Size:</td>
<% ByteFormat byteFormatter = new ByteFormat(); %>
<td width="1%" nowrap><%= byteFormatter.format(logFile.length()) %></td>
<td class="label" width="1%">Refresh:</td>
<td width="1%" nowrap>
<td colspan="2">
<script language="JavaScript" type="text/javascript">
<!--
function setLog(log) {
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();">
<% for (int j=0; j<REFRESHES.length; j++) {
String selected = REFRESHES[j].equals(refreshParam)?" selected":"";
......@@ -612,72 +386,61 @@ SELECT {
</td>
</tr>
<% // Print out a special switch to enable/disable debugging
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>
<% if ("debug".equals(log)) { %>
<input type="radio" name="debugEnabled" value="true"<%= ((debugEnabled) ? " checked" : "") %> id="de01">
<label for="de01">Enabled</label>
<tr>
<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">
<label for="de02">Disabled</label>
(change requires restart)
<br>
</td>
<td width="1%" nowrap>
<label for="de02">Disabled</label> &nbsp;
</td>
<td width="1%">
<input type="hidden" name="wasDebugEnabled" value="<%= debugEnabled %>">
<input type="submit" name="" value="Update">
</td>
<td colspan="3">&nbsp;</td>
<td width="94%">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<% } %>
<tr><td colspan="5"><img src="images/blank.gif" width="1" height="8" border="0"></td></tr>
</table>
</span>
</td></tr>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<span class="log">
<table cellpadding="1" cellspacing="0" border="0" width="100%">
<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 class="jive-description" style="color:#666;">
Log dir: <%= JiveGlobals.getMessengerHome() %><%= File.separator %>logs
</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>
</div>
<jsp:include page="bottom.jsp" flush="true" />
\ No newline at end of file
<%@ taglib uri="core" prefix="c"%>
<%@ taglib uri="fmt" prefix="fmt" %>
<%--
- $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="org.jivesoftware.util.*,
org.jivesoftware.messenger.XMPPServerInfo,
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 --%>
<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" />
<% admin.init(request, response, session, application, out ); %>
<c:set var="admin" value="${admin.manager}" />
<!-- Define Title and BreadCrumbs -->
<c:set var="title" value="Server Properties" />
<c:set var="breadcrumbs" value="${admin.breadCrumbs}" />
<c:set target="${breadcrumbs}" property="Home" value="main.jsp" />
<c:set target="${breadcrumbs}" property="${title}" value="server-props.jsp" />
<% // Title of this page and breadcrumbs
String title = "Server Properties";
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "main.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="title.jsp" flush="true" />
<p>
Below is a list of information for this <fmt:message key="short.title" bundle="${lang}" /> server.
......
......@@ -2,6 +2,11 @@
- $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="org.jivesoftware.util.*,
......@@ -10,23 +15,28 @@
org.jivesoftware.messenger.XMPPServer,
org.jivesoftware.messenger.container.*,
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="fmt" prefix="ftm" %>
<%@ taglib uri="fmt" prefix="fmt" %>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<%-- Define Administration Bean --%>
<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" />
<% admin.init(request, response, session, application, out ); %>
<!-- Define Title and BreadCrumbs -->
<c:set var="title" value="Server Status" />
<c:set var="breadcrumbs" value="${admin.breadCrumbs}" />
<c:set target="${breadcrumbs}" property="Home" value="main.jsp" />
<c:set target="${breadcrumbs}" property="${title}" value="server-status.jsp" />
<% // Title of this page and breadcrumbs
String title = "Server Status";
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "main.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="title.jsp" flush="true" />
<% // Get parameters //
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