From 557f8d80e40ac6e457841a3f57cd619126ec781d Mon Sep 17 00:00:00 2001 From: orbiter Date: Wed, 18 Jul 2007 13:03:20 +0000 Subject: [PATCH] - better logging - fixed bugs in auto-update git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3990 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/plasma/plasmaParser.java | 2 ++ source/de/anomic/yacy/yacyDHTAction.java | 8 +++++--- source/de/anomic/yacy/yacyVersion.java | 18 +++++++++--------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/source/de/anomic/plasma/plasmaParser.java b/source/de/anomic/plasma/plasmaParser.java index 68feb2397..5fe1ddfcd 100644 --- a/source/de/anomic/plasma/plasmaParser.java +++ b/source/de/anomic/plasma/plasmaParser.java @@ -537,8 +537,10 @@ public final class plasmaParser { } catch (Exception e) { /* we can ignore this for the moment */ serverLog.logWarning("PARSER", "Parser '" + className + "' doesn't work correctly and will be ignored.\n [" + e.getClass().getName() + "]: " + e.getMessage()); + e.printStackTrace(); } catch (Error e) { /* we can ignore this for the moment */ serverLog.logWarning("PARSER", "Parser '" + className + "' doesn't work correctly and will be ignored.\n [" + e.getClass().getName() + "]: " + e.getMessage()); + e.printStackTrace(); } } } diff --git a/source/de/anomic/yacy/yacyDHTAction.java b/source/de/anomic/yacy/yacyDHTAction.java index 66a1e3ce8..4003c4631 100644 --- a/source/de/anomic/yacy/yacyDHTAction.java +++ b/source/de/anomic/yacy/yacyDHTAction.java @@ -313,12 +313,14 @@ public class yacyDHTAction implements yacyPeerAction { if (seeds != null) { firstdist = yacyDHTAction.dhtDistance(seed.hash, firstKey); lastdist = yacyDHTAction.dhtDistance(seed.hash, lastKey); - if ((lastdist < maxDist) && (!(doublecheck.contains(seed.hash)))) { + if (lastdist > maxDist) { + if (log != null) log.logFine("Discarded too distant DHT target peer " + seed.getName() + ":" + seed.hash + ", distance2first = " + firstdist + ", distance2last = " + lastdist); + } else if (doublecheck.contains(seed.hash)) { + if (log != null) log.logFine("Discarded double DHT target peer " + seed.getName() + ":" + seed.hash + ", distance2first = " + firstdist + ", distance2last = " + lastdist); + } else { if (log != null) log.logInfo("Selected " + ((seeds.size() < primaryPeerCount) ? "primary" : "reserve") + " DHT target peer " + seed.getName() + ":" + seed.hash + ", distance2first = " + firstdist + ", distance2last = " + lastdist); seeds.add(seed); doublecheck.add(seed.hash); - } else { - if (log != null) log.logInfo("Discarded improper DHT target peer " + seed.getName() + ":" + seed.hash + ", distance2first = " + firstdist + ", distance2last = " + lastdist); } } } diff --git a/source/de/anomic/yacy/yacyVersion.java b/source/de/anomic/yacy/yacyVersion.java index 5601ebc12..c1c33d665 100644 --- a/source/de/anomic/yacy/yacyVersion.java +++ b/source/de/anomic/yacy/yacyVersion.java @@ -200,7 +200,7 @@ public final class yacyVersion implements Comparator, Comparable { // check if update process allowes update retrieve String process = sb.getConfig("update.process", "manual"); if ((!manual) && (!process.equals("auto"))) { - yacyCore.log.logInfo("rulebasedUpdateInfo: not a automatic update selected"); + yacyCore.log.logInfo("rulebasedUpdateInfo: not an automatic update selected"); return null; // no, its a manual or guided process } @@ -208,31 +208,31 @@ public final class yacyVersion implements Comparator, Comparable { long cycle = Math.max(1, sb.getConfigLong("update.cycle", 168)) * 24 * 60 * 60 * 1000; long timeLookup = sb.getConfigLong("update.time.lookup", System.currentTimeMillis()); if ((!manual) && (timeLookup + cycle > System.currentTimeMillis())) { - yacyCore.log.logInfo("rulebasedUpdateInfo: too early for a lookup for a new release"); + yacyCore.log.logInfo("rulebasedUpdateInfo: too early for a lookup for a new release (timeLookup = " + timeLookup + ", cycle = " + cycle + ", now = " + System.currentTimeMillis() + ")"); return null; // no we have recently made a lookup } // check if we know that there is a release that is more recent than that which we are using TreeSet[] releasess = yacyVersion.allReleases(true); // {0=promain, 1=prodev, 2=stdmain, 3=stddev} boolean pro = new File(sb.getRootPath(), "libx").exists(); - yacyVersion latestmain = (yacyVersion) releasess[(pro) ? 0 : 2].first(); - yacyVersion latestdev = (yacyVersion) releasess[(pro) ? 1 : 3].first(); + yacyVersion latestmain = (yacyVersion) releasess[(pro) ? 0 : 2].last(); + yacyVersion latestdev = (yacyVersion) releasess[(pro) ? 1 : 3].last(); String concept = sb.getConfig("update.concept", "any"); String blacklist = sb.getConfig("update.blacklist", ".\\...[123]"); if ((manual) || (concept.equals("any"))) { // return a dev-release or a main-release if ((latestdev.compareTo(latestmain) > 0) && (!(Float.toString(latestdev.releaseNr).matches(blacklist)))) { if (latestdev.compareTo(thisVersion()) > 0) return latestdev; else { - yacyCore.log.logInfo("rulebasedUpdateInfo: latest dev is not more recent than installed release"); + yacyCore.log.logInfo("rulebasedUpdateInfo: latest dev " + latestdev.name + " is not more recent than installed release " + thisVersion().name); return null; } } else { if ((Float.toString(latestmain.releaseNr).matches(blacklist))) { - yacyCore.log.logInfo("rulebasedUpdateInfo: latest dev matches with blacklist"); + yacyCore.log.logInfo("rulebasedUpdateInfo: latest dev " + latestdev.name + " matches with blacklist '" + blacklist + "'"); return null; } if (latestmain.compareTo(thisVersion()) > 0) return latestmain; else { - yacyCore.log.logInfo("rulebasedUpdateInfo: latest main is not more recent than installed release (1)"); + yacyCore.log.logInfo("rulebasedUpdateInfo: latest main " + latestmain.name + " is not more recent than installed release (1) " + thisVersion().name); return null; } } @@ -240,11 +240,11 @@ public final class yacyVersion implements Comparator, Comparable { if (concept.equals("main")) { // return a main-release if ((Float.toString(latestmain.releaseNr).matches(blacklist))) { - yacyCore.log.logInfo("rulebasedUpdateInfo: latest main matches with blacklist"); + yacyCore.log.logInfo("rulebasedUpdateInfo: latest main " + latestmain.name + " matches with blacklist'" + blacklist + "'"); return null; } if (latestmain.compareTo(thisVersion()) > 0) return latestmain; else { - yacyCore.log.logInfo("rulebasedUpdateInfo: latest main is not more recent than installed release (2)"); + yacyCore.log.logInfo("rulebasedUpdateInfo: latest main " + latestmain.name + " is not more recent than installed release (2) " + thisVersion().name); return null; } }