redirect uncaught exceptions to logging + small other changes

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7042 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent 237cfc44b0
commit 7fdb17bb96

@ -51,7 +51,7 @@
#(commitRobinsonWithRemoteIndexing)#::<div class="commit">This Robinson Mode switches remote indexing on, but limits targets to peers within the same cluster. Remote indexing requests from peers within the same cluster are accepted.</div>#(/commitRobinsonWithRemoteIndexing)#
#(commitRobinsonWithoutRemoteIndexing)#::<div class="commit">This Robinson Mode does not allow any remote indexing (neither requests remote indexing, nor accepts it).</div>#(/commitRobinsonWithoutRemoteIndexing)#
#(commitPasswordWarning)#::<div class="error">With this configuration it is not allowed to authentify automatically from localhost! Please open the <a href="ConfigAccounts_p.html">Account Configuration</a> and set a new password.</div>#(/commitPasswordWarning)#
<form id="NetworkForm" method="post" action="ConfigNetwork_p.html" enctype="multipart/form-data" accept-charset="UTF-8">
<form name="NetworkForm" method="post" action="ConfigNetwork_p.html" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<legend>
<label>Network and Domain Specification</label>

@ -363,13 +363,13 @@ public class Balancer {
//final int s = urlFileIndex.size();
Row.Entry rowEntry = (nexthash == null) ? null : urlFileIndex.remove(nexthash);
if (rowEntry == null) {
System.out.println("*** rowEntry=null, nexthash=" + nexthash);
System.out.println("*** rowEntry=null, nexthash=" + new String(nexthash));
rowEntry = urlFileIndex.removeOne();
if (rowEntry == null) {
nexthash = null;
} else {
nexthash = rowEntry.getPrimaryKeyBytes();
//System.out.println("*** rowEntry.getPrimaryKeyBytes()=" + nexthash);
//System.out.println("*** rowEntry.getPrimaryKeyBytes()=" + new String(nexthash));
}
}

@ -164,6 +164,7 @@ public class ResultFetcher {
// get next entry
page = rankedCache.takeURL(true, taketimeout);
//if (page == null) page = rankedCache.takeURL(false, taketimeout);
if (page == null) break;
if (failedURLs.has(page.hash())) continue;

@ -364,10 +364,19 @@ public final class Log {
// generating the root logger
/*Logger logger =*/ Logger.getLogger("");
// System.setOut(new PrintStream(new LoggerOutputStream(Logger.getLogger("STDOUT"), Level.FINEST)));
// System.setErr(new PrintStream(new LoggerOutputStream(Logger.getLogger("STDERR"), Level.SEVERE)));
logRunnerThread = new logRunner();
logRunnerThread.start();
// redirect uncaught exceptions to logging
final Log exceptionLog = new Log("UNCAUGHT-EXCEPTION");
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler(){
public void uncaughtException(final Thread t, final Throwable e) {
String msg = String.format("Thread %s: %s",t.getName(), e.getMessage());
exceptionLog.logWarning(msg);
System.err.print("Exception in thread \"" + t.getName() + "\" ");
e.printStackTrace(System.err);
}
});
} finally {
if (fileIn != null) try {fileIn.close();}catch(final Exception e){}
}
@ -398,5 +407,4 @@ public final class Log {
for (int i = 0; i < alength; i++) if (a[astart + i] != 0) return false;
return true;
}
}

Loading…
Cancel
Save