Commit 6b91addb authored by akrherz's avatar akrherz Committed by Guus der Kinderen

OF-1380 Add all.log to Admin Console log viewer

parent 95be0a4e
......@@ -1112,6 +1112,7 @@ login.version=Version
# Logviewer Page
logviewer.title=Log Viewer
logviewer.all=All
logviewer.error=Error
logviewer.warn=Warn
logviewer.info=Info
......
......@@ -307,6 +307,13 @@ public class Log {
emptyFile(logFile);
}
public static void rotateAllLogFile() {
// SLF4J doesn't provide a hook into the logging implementation. We'll have to do this 'direct', bypassing slf4j.
File logFile = new File(Log.getLogDirectory(), "all.log");
emptyFile(logFile);
}
/**
* Returns the directory that log files exist in. The directory name will
* have a File.separator as the last character in the string.
......
......@@ -83,13 +83,13 @@
String mode = ParamUtils.getParameter(request,"mode");
// Only allow requests for valid log file names.
if (!("debug".equals(log) || "warn".equals(log) || "info".equals(log) || "error".equals(log))) {
if (!("debug".equals(log) || "warn".equals(log) || "info".equals(log) || "error".equals(log) || "all".equals(log))) {
log = null;
}
// Set defaults
if (log == null) {
log = "error";
log = "all";
}
if (mode == null) {
mode = "asc";
......
......@@ -35,11 +35,12 @@
<%!
static final String NONE = LocaleUtils.getLocalizedString("global.none");
static final String ALL = "all";
static final String ERROR = "error";
static final String INFO = "info";
static final String WARN = "warn";
static final String DEBUG = "debug";
static final String DEFAULT = ERROR;
static final String DEFAULT = ALL;
static final String ASCENDING = "asc";
static final String DESCENDING = "desc";
......@@ -87,7 +88,7 @@
{
// Get the cookie associated with the log files
HashMap cookie = parseCookie(CookieUtils.getCookie(request,"jiveforums.admin.logviewer"));
String[] logs = {"error", "info", "warn", "debug"};
String[] logs = {"all", "error", "info", "warn", "debug"};
HashMap<String,String> newCookie = new HashMap<String,String>();
HashMap<String,String> updates = new HashMap<String,String>();
for (String log : logs) {
......@@ -151,7 +152,10 @@
if (clearLog && log != null) {
if (!(csrfCookie == null || csrfParam == null || !csrfCookie.getValue().equals(csrfParam))) {
if ("error".equals(log)) {
if ("all".equals(log)) {
Log.rotateAllLogFile();
}
else if ("error".equals(log)) {
Log.rotateErrorLogFile();
}
else if ("warn".equals(log)) {
......@@ -267,6 +271,14 @@ IFRAME {
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td class="jive-spacer" width="1%">&nbsp;</td>
<td class="jive-tab<%= (("all".equals(log))?"-active":"") %>" width="1%">
<a href="logviewer.jsp?log=all"
><fmt:message key="logviewer.all" /></a>
<span class="new">
<%= ((newlogs.containsKey("all"))?"*":"") %>
</span>
</td>
<td class="jive-spacer" width="1%">&nbsp;</td>
<td class="jive-tab<%= (("error".equals(log))?"-active":"") %>" width="1%">
<a href="logviewer.jsp?log=error"
......@@ -383,6 +395,7 @@ IFRAME {
<a href="#" onclick="if (confirm('<fmt:message key="logviewer.confirm" />')) {setLog('clearLog'); document.logViewer.submit(); return true;} else { return false; }"
><fmt:message key="logviewer.clear" /></a>
</td>
<% if (! "all".equals(log)) { %>
<td class="icon">
<a href="#" onclick="setLog('markLog'); document.logViewer.submit(); return true;"><img src="images/mark-16x16.gif" border="0" alt="<fmt:message key="logviewer.alt_mark" />"></a>
</td>
......@@ -390,6 +403,7 @@ IFRAME {
<a href="#" onclick="setLog('markLog'); document.logViewer.submit(); return true;"
><fmt:message key="logviewer.mark" /></a>
</td>
<% } %>
</tr>
</tbody>
</table>
......
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