From 761dbdf06d1de09e45f0963102e43ffe07b6cdaa Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Wed, 5 Oct 2022 16:09:28 +0200 Subject: [PATCH] increases log history length to 10000 implements https://github.com/yacy/yacy_search_server/issues/512 --- defaults/yacy.logging | 2 +- htroot/ViewLog_p.html | 2 +- source/net/yacy/cora/util/ConcurrentLog.java | 20 +++++++++---------- source/net/yacy/htroot/ViewLog_p.java | 10 +++++----- .../net/yacy/kelondro/logging/GuiHandler.java | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/defaults/yacy.logging b/defaults/yacy.logging index e3662f9f5..c0a0f5d2c 100644 --- a/defaults/yacy.logging +++ b/defaults/yacy.logging @@ -51,7 +51,7 @@ net.yacy.crawler.robots.RobotsTxt.level = SEVERE # Properties for the GuiHandler net.yacy.kelondro.logging.GuiHandler.level = ALL net.yacy.kelondro.logging.GuiHandler.formatter=net.yacy.kelondro.logging.SimpleLogFormatter -net.yacy.kelondro.logging.GuiHandler.size = 1000 +net.yacy.kelondro.logging.GuiHandler.size = 10000 # Properties for the ConsoleOutErrHandler net.yacy.kelondro.logging.ConsoleOutErrHandler.level = ALL diff --git a/htroot/ViewLog_p.html b/htroot/ViewLog_p.html index f9027a9e1..6ef10300d 100644 --- a/htroot/ViewLog_p.html +++ b/htroot/ViewLog_p.html @@ -11,7 +11,7 @@
- + diff --git a/source/net/yacy/cora/util/ConcurrentLog.java b/source/net/yacy/cora/util/ConcurrentLog.java index 15e51eb49..90dbb6efe 100644 --- a/source/net/yacy/cora/util/ConcurrentLog.java +++ b/source/net/yacy/cora/util/ConcurrentLog.java @@ -49,7 +49,7 @@ public final class ConcurrentLog { private final static Logger ConcurrentLogLogger = Logger.getLogger("ConcurrentLog"); private final static Message POISON_MESSAGE = new Message(); - private final static BlockingQueue logQueue = new ArrayBlockingQueue(500); + private final static BlockingQueue logQueue = new ArrayBlockingQueue<>(2000); private static Worker logRunnerThread = null; public static boolean backgroundRunner = false; @@ -61,7 +61,7 @@ public final class ConcurrentLog { if (backgroundRunner && (logRunnerThread == null || !logRunnerThread.isAlive())) { logRunnerThread = new Worker(); logRunnerThread.start(); - //ConcurrentLogLogger.log(Level.INFO, "started ConcurrentLog.Worker."); + ConcurrentLogLogger.log(Level.INFO, "started ConcurrentLog.Worker."); } } @@ -156,7 +156,7 @@ public final class ConcurrentLog { } public final boolean isFiner() { - return this.theLogger.isLoggable(Level.FINER); + return this.theLogger.isLoggable(Level.FINER); } public final void finest(final String message) { @@ -181,7 +181,7 @@ public final class ConcurrentLog { if (thrown == null) return; enQueueLog(this.theLogger, Level.WARNING, thrown.getMessage(), thrown); } - */ + */ // static log messages public final static void logException(final Throwable thrown) { @@ -352,7 +352,7 @@ public final class ConcurrentLog { @Override public void run() { Message entry; - Map loggerCache = new HashMap(); + final Map loggerCache = new HashMap<>(); try { while ((entry = logQueue.take()) != POISON_MESSAGE) { if (entry.logger == null) { @@ -415,7 +415,7 @@ public final class ConcurrentLog { // creating the logging directory if necessary - File logDirectory = logFile.getParentFile(); + final File logDirectory = logFile.getParentFile(); if(logDirectory != null) { if (!logDirectory.exists()) { if(!logDirectory.mkdirs()) { @@ -447,7 +447,7 @@ public final class ConcurrentLog { exceptionLog.severe(msg + "\n" + baos.toString(), e); ConcurrentLogLogger.log(Level.SEVERE, e.getMessage(), e); if (e instanceof InvocationTargetException) { - Throwable target = ((InvocationTargetException) e).getTargetException(); + final Throwable target = ((InvocationTargetException) e).getTargetException(); ConcurrentLogLogger.log(Level.SEVERE, target.getMessage(), target); } } @@ -470,9 +470,9 @@ public final class ConcurrentLog { } public static String stackTrace() { - Throwable t = new Throwable(); - StackTraceElement[] e = t.getStackTrace(); - StringBuilder sb = new StringBuilder(80); + final Throwable t = new Throwable(); + final StackTraceElement[] e = t.getStackTrace(); + final StringBuilder sb = new StringBuilder(80); for (int i = 2; i < e.length - 1; i++) { sb.append(e[i].toString()).append(" -> "); } diff --git a/source/net/yacy/htroot/ViewLog_p.java b/source/net/yacy/htroot/ViewLog_p.java index f0a2df9d2..3df1a45d0 100644 --- a/source/net/yacy/htroot/ViewLog_p.java +++ b/source/net/yacy/htroot/ViewLog_p.java @@ -52,7 +52,7 @@ public class ViewLog_p { String[] log = new String[0]; boolean reversed = true; boolean json = false; - int maxlines = 1000, lines = 1000; + int maxlines = 10000, lines = 10000; /* Usually a regex like this would make no sense, ".*" would be * sufficient, but ".*.*" makes it a little bit more convenient * for the user to input regexes like ".*FOO.*" in the HTML @@ -83,13 +83,13 @@ public class ViewLog_p { log = ((GuiHandler)handler).getLogLines(reversed,lines); } else if (handler instanceof LogalizerHandler) { displaySubmenu = true; - } + } } prop.put("submenu", displaySubmenu ? "1" : "0"); prop.put("reverseChecked", reversed ? "1" : "0"); prop.put("lines", lines); - prop.put("maxlines",maxlines); + prop.put("maxlines", maxlines); prop.putHTML("filter", filter); // trying to compile the regular expression filter expression @@ -108,8 +108,8 @@ public class ViewLog_p { final String nextLogLine = logLine.trim(); if (filterMatcher != null) { - filterMatcher.reset(nextLogLine); - if (!filterMatcher.find()) continue; + filterMatcher.reset(nextLogLine); + if (!filterMatcher.find()) continue; } if (nextLogLine.startsWith("E ")) { diff --git a/source/net/yacy/kelondro/logging/GuiHandler.java b/source/net/yacy/kelondro/logging/GuiHandler.java index 51d9153ed..69119cdc6 100644 --- a/source/net/yacy/kelondro/logging/GuiHandler.java +++ b/source/net/yacy/kelondro/logging/GuiHandler.java @@ -43,7 +43,7 @@ import net.yacy.kelondro.util.MemoryControl; public class GuiHandler extends Handler { - private final static int DEFAULT_SIZE = 1000; // don't make this too big, it eats up a lot of memory! + private final static int DEFAULT_SIZE = 10000; // don't make this too big, it eats up a lot of memory! private static int size = DEFAULT_SIZE; private static String buffer[]; private static int start, count; @@ -86,7 +86,7 @@ public class GuiHandler extends Handler { } public final int getSize() { - return GuiHandler.size; + return GuiHandler.size; } @Override