- better logging

- fixed bugs in auto-update

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3990 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 18 years ago
parent f323e1813d
commit 557f8d80e4

@ -537,8 +537,10 @@ public final class plasmaParser {
} catch (Exception e) { /* we can ignore this for the moment */ } 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()); 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 */ } 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()); serverLog.logWarning("PARSER", "Parser '" + className + "' doesn't work correctly and will be ignored.\n [" + e.getClass().getName() + "]: " + e.getMessage());
e.printStackTrace();
} }
} }
} }

@ -313,12 +313,14 @@ public class yacyDHTAction implements yacyPeerAction {
if (seeds != null) { if (seeds != null) {
firstdist = yacyDHTAction.dhtDistance(seed.hash, firstKey); firstdist = yacyDHTAction.dhtDistance(seed.hash, firstKey);
lastdist = yacyDHTAction.dhtDistance(seed.hash, lastKey); 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); 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); seeds.add(seed);
doublecheck.add(seed.hash); doublecheck.add(seed.hash);
} else {
if (log != null) log.logInfo("Discarded improper DHT target peer " + seed.getName() + ":" + seed.hash + ", distance2first = " + firstdist + ", distance2last = " + lastdist);
} }
} }
} }

@ -200,7 +200,7 @@ public final class yacyVersion implements Comparator, Comparable {
// check if update process allowes update retrieve // check if update process allowes update retrieve
String process = sb.getConfig("update.process", "manual"); String process = sb.getConfig("update.process", "manual");
if ((!manual) && (!process.equals("auto"))) { 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 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 cycle = Math.max(1, sb.getConfigLong("update.cycle", 168)) * 24 * 60 * 60 * 1000;
long timeLookup = sb.getConfigLong("update.time.lookup", System.currentTimeMillis()); long timeLookup = sb.getConfigLong("update.time.lookup", System.currentTimeMillis());
if ((!manual) && (timeLookup + cycle > 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 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 // 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} TreeSet[] releasess = yacyVersion.allReleases(true); // {0=promain, 1=prodev, 2=stdmain, 3=stddev}
boolean pro = new File(sb.getRootPath(), "libx").exists(); boolean pro = new File(sb.getRootPath(), "libx").exists();
yacyVersion latestmain = (yacyVersion) releasess[(pro) ? 0 : 2].first(); yacyVersion latestmain = (yacyVersion) releasess[(pro) ? 0 : 2].last();
yacyVersion latestdev = (yacyVersion) releasess[(pro) ? 1 : 3].first(); yacyVersion latestdev = (yacyVersion) releasess[(pro) ? 1 : 3].last();
String concept = sb.getConfig("update.concept", "any"); String concept = sb.getConfig("update.concept", "any");
String blacklist = sb.getConfig("update.blacklist", ".\\...[123]"); String blacklist = sb.getConfig("update.blacklist", ".\\...[123]");
if ((manual) || (concept.equals("any"))) { if ((manual) || (concept.equals("any"))) {
// return a dev-release or a main-release // return a dev-release or a main-release
if ((latestdev.compareTo(latestmain) > 0) && (!(Float.toString(latestdev.releaseNr).matches(blacklist)))) { if ((latestdev.compareTo(latestmain) > 0) && (!(Float.toString(latestdev.releaseNr).matches(blacklist)))) {
if (latestdev.compareTo(thisVersion()) > 0) return latestdev; else { 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; return null;
} }
} else { } else {
if ((Float.toString(latestmain.releaseNr).matches(blacklist))) { 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; return null;
} }
if (latestmain.compareTo(thisVersion()) > 0) return latestmain; else { 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; return null;
} }
} }
@ -240,11 +240,11 @@ public final class yacyVersion implements Comparator, Comparable {
if (concept.equals("main")) { if (concept.equals("main")) {
// return a main-release // return a main-release
if ((Float.toString(latestmain.releaseNr).matches(blacklist))) { 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; return null;
} }
if (latestmain.compareTo(thisVersion()) > 0) return latestmain; else { 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; return null;
} }
} }

Loading…
Cancel
Save