increases log history length to 10000

implements https://github.com/yacy/yacy_search_server/issues/512
pull/533/head
Michael Peter Christen 2 years ago
parent 0970a79bbf
commit 761dbdf06d

@ -51,7 +51,7 @@ net.yacy.crawler.robots.RobotsTxt.level = SEVERE
# Properties for the GuiHandler # Properties for the GuiHandler
net.yacy.kelondro.logging.GuiHandler.level = ALL net.yacy.kelondro.logging.GuiHandler.level = ALL
net.yacy.kelondro.logging.GuiHandler.formatter=net.yacy.kelondro.logging.SimpleLogFormatter 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 # Properties for the ConsoleOutErrHandler
net.yacy.kelondro.logging.ConsoleOutErrHandler.level = ALL net.yacy.kelondro.logging.ConsoleOutErrHandler.level = ALL

@ -11,7 +11,7 @@
<form action="ViewLog_p.html" method="get" accept-charset="UTF-8"> <form action="ViewLog_p.html" method="get" accept-charset="UTF-8">
<fieldset> <fieldset>
<input type="text" name="lines" id="lines" size ="5" value="#[lines]#" maxlength="9" /><label for="lines"> Lines (max. #[maxlines]#)</label> <input type="text" name="lines" id="lines" size ="6" value="#[lines]#" maxlength="9" /><label for="lines"> Lines (max. #[maxlines]#)</label>
<input type="checkbox" name="mode" id="mode" value="reversed" #(reverseChecked)#::checked="checked"#(/reverseChecked)# /><label for="mode">reversed order</label> <input type="checkbox" name="mode" id="mode" value="reversed" #(reverseChecked)#::checked="checked"#(/reverseChecked)# /><label for="mode">reversed order</label>
<input type="text" name="filter" id="filter" size ="30" value="#[filter]#" maxlength="60" /> <input type="text" name="filter" id="filter" size ="30" value="#[filter]#" maxlength="60" />
<input type="submit" value="refresh" /> <input type="submit" value="refresh" />

@ -49,7 +49,7 @@ public final class ConcurrentLog {
private final static Logger ConcurrentLogLogger = Logger.getLogger("ConcurrentLog"); private final static Logger ConcurrentLogLogger = Logger.getLogger("ConcurrentLog");
private final static Message POISON_MESSAGE = new Message(); private final static Message POISON_MESSAGE = new Message();
private final static BlockingQueue<Message> logQueue = new ArrayBlockingQueue<Message>(500); private final static BlockingQueue<Message> logQueue = new ArrayBlockingQueue<>(2000);
private static Worker logRunnerThread = null; private static Worker logRunnerThread = null;
public static boolean backgroundRunner = false; public static boolean backgroundRunner = false;
@ -61,7 +61,7 @@ public final class ConcurrentLog {
if (backgroundRunner && (logRunnerThread == null || !logRunnerThread.isAlive())) { if (backgroundRunner && (logRunnerThread == null || !logRunnerThread.isAlive())) {
logRunnerThread = new Worker(); logRunnerThread = new Worker();
logRunnerThread.start(); 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() { public final boolean isFiner() {
return this.theLogger.isLoggable(Level.FINER); return this.theLogger.isLoggable(Level.FINER);
} }
public final void finest(final String message) { public final void finest(final String message) {
@ -181,7 +181,7 @@ public final class ConcurrentLog {
if (thrown == null) return; if (thrown == null) return;
enQueueLog(this.theLogger, Level.WARNING, thrown.getMessage(), thrown); enQueueLog(this.theLogger, Level.WARNING, thrown.getMessage(), thrown);
} }
*/ */
// static log messages // static log messages
public final static void logException(final Throwable thrown) { public final static void logException(final Throwable thrown) {
@ -352,7 +352,7 @@ public final class ConcurrentLog {
@Override @Override
public void run() { public void run() {
Message entry; Message entry;
Map<String, Logger> loggerCache = new HashMap<String, Logger>(); final Map<String, Logger> loggerCache = new HashMap<>();
try { try {
while ((entry = logQueue.take()) != POISON_MESSAGE) { while ((entry = logQueue.take()) != POISON_MESSAGE) {
if (entry.logger == null) { if (entry.logger == null) {
@ -415,7 +415,7 @@ public final class ConcurrentLog {
// creating the logging directory if necessary // creating the logging directory if necessary
File logDirectory = logFile.getParentFile(); final File logDirectory = logFile.getParentFile();
if(logDirectory != null) { if(logDirectory != null) {
if (!logDirectory.exists()) { if (!logDirectory.exists()) {
if(!logDirectory.mkdirs()) { if(!logDirectory.mkdirs()) {
@ -447,7 +447,7 @@ public final class ConcurrentLog {
exceptionLog.severe(msg + "\n" + baos.toString(), e); exceptionLog.severe(msg + "\n" + baos.toString(), e);
ConcurrentLogLogger.log(Level.SEVERE, e.getMessage(), e); ConcurrentLogLogger.log(Level.SEVERE, e.getMessage(), e);
if (e instanceof InvocationTargetException) { if (e instanceof InvocationTargetException) {
Throwable target = ((InvocationTargetException) e).getTargetException(); final Throwable target = ((InvocationTargetException) e).getTargetException();
ConcurrentLogLogger.log(Level.SEVERE, target.getMessage(), target); ConcurrentLogLogger.log(Level.SEVERE, target.getMessage(), target);
} }
} }
@ -470,9 +470,9 @@ public final class ConcurrentLog {
} }
public static String stackTrace() { public static String stackTrace() {
Throwable t = new Throwable(); final Throwable t = new Throwable();
StackTraceElement[] e = t.getStackTrace(); final StackTraceElement[] e = t.getStackTrace();
StringBuilder sb = new StringBuilder(80); final StringBuilder sb = new StringBuilder(80);
for (int i = 2; i < e.length - 1; i++) { for (int i = 2; i < e.length - 1; i++) {
sb.append(e[i].toString()).append(" -> "); sb.append(e[i].toString()).append(" -> ");
} }

@ -52,7 +52,7 @@ public class ViewLog_p {
String[] log = new String[0]; String[] log = new String[0];
boolean reversed = true; boolean reversed = true;
boolean json = false; boolean json = false;
int maxlines = 1000, lines = 1000; int maxlines = 10000, lines = 10000;
/* Usually a regex like this would make no sense, ".*" would be /* Usually a regex like this would make no sense, ".*" would be
* sufficient, but ".*.*" makes it a little bit more convenient * sufficient, but ".*.*" makes it a little bit more convenient
* for the user to input regexes like ".*FOO.*" in the HTML * 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); log = ((GuiHandler)handler).getLogLines(reversed,lines);
} else if (handler instanceof LogalizerHandler) { } else if (handler instanceof LogalizerHandler) {
displaySubmenu = true; displaySubmenu = true;
} }
} }
prop.put("submenu", displaySubmenu ? "1" : "0"); prop.put("submenu", displaySubmenu ? "1" : "0");
prop.put("reverseChecked", reversed ? "1" : "0"); prop.put("reverseChecked", reversed ? "1" : "0");
prop.put("lines", lines); prop.put("lines", lines);
prop.put("maxlines",maxlines); prop.put("maxlines", maxlines);
prop.putHTML("filter", filter); prop.putHTML("filter", filter);
// trying to compile the regular expression filter expression // trying to compile the regular expression filter expression
@ -108,8 +108,8 @@ public class ViewLog_p {
final String nextLogLine = logLine.trim(); final String nextLogLine = logLine.trim();
if (filterMatcher != null) { if (filterMatcher != null) {
filterMatcher.reset(nextLogLine); filterMatcher.reset(nextLogLine);
if (!filterMatcher.find()) continue; if (!filterMatcher.find()) continue;
} }
if (nextLogLine.startsWith("E ")) { if (nextLogLine.startsWith("E ")) {

@ -43,7 +43,7 @@ import net.yacy.kelondro.util.MemoryControl;
public class GuiHandler extends Handler { 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 int size = DEFAULT_SIZE;
private static String buffer[]; private static String buffer[];
private static int start, count; private static int start, count;
@ -86,7 +86,7 @@ public class GuiHandler extends Handler {
} }
public final int getSize() { public final int getSize() {
return GuiHandler.size; return GuiHandler.size;
} }
@Override @Override

Loading…
Cancel
Save