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