From 8b2ceddb91d4317cf34ae9651a15b69b8b634ba5 Mon Sep 17 00:00:00 2001 From: theli Date: Sat, 30 Sep 2006 08:12:22 +0000 Subject: [PATCH] *) Displaying servere and warning logging messages in different colors on ViewLog_p.html git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2678 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/ViewLog_p.html | 5 ++- htroot/ViewLog_p.java | 21 +++++++++-- htroot/env/base.css | 37 +++++++++++++++++-- .../de/anomic/server/logging/GuiHandler.java | 27 ++++++++++++++ 4 files changed, 80 insertions(+), 10 deletions(-) diff --git a/htroot/ViewLog_p.html b/htroot/ViewLog_p.html index 123a3e70e..93d9138d5 100644 --- a/htroot/ViewLog_p.html +++ b/htroot/ViewLog_p.html @@ -16,8 +16,9 @@ -
#[log]#
- +
+ #{log}#
#[line]#
#{/log}# +
#%env/templates/footer.template%# diff --git a/htroot/ViewLog_p.java b/htroot/ViewLog_p.java index e492c3497..1f59be1f4 100644 --- a/htroot/ViewLog_p.java +++ b/htroot/ViewLog_p.java @@ -56,10 +56,9 @@ import de.anomic.server.logging.GuiHandler; public class ViewLog_p { - public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) { serverObjects prop = new serverObjects(); - String log = ""; + String[] log = new String[0]; boolean reversed = false; int lines = 50; @@ -77,15 +76,29 @@ public class ViewLog_p { Handler[] handlers = logger.getHandlers(); for (int i=0; i this.count)||(lineCount < 0)) lineCount = this.count; + + ArrayList logMessages = new ArrayList(this.count); + Formatter logFormatter = getFormatter(); + + try { + int start = (reversed)?this.start+this.count-1:this.start; + LogRecord record=null; + for (int i = 0; i < lineCount; i++) { + int ix = (reversed) ? + Math.abs((start-i)%this.buffer.length) : + (start+i)%this.buffer.length; + record = this.buffer[ix]; + logMessages.add(logFormatter.format(record)); + } + return (String[])logMessages.toArray(new String[logMessages.size()]); + } catch (Exception ex) { + // We don't want to throw an exception here, but we + // report the exception to any registered ErrorManager. + reportError(null, ex, ErrorManager.FORMAT_FAILURE); + return new String[]{"Error while formatting the logging message"}; + } + } + public void flush() { // TODO Auto-generated method stub