less usage of generic logger to avoid logger generation overhead

pull/1/head
orbiter 13 years ago
parent a196f24f60
commit c00a3cf74d

@ -78,6 +78,7 @@ import net.yacy.search.query.AccessTracker;
import net.yacy.search.query.QueryParams; import net.yacy.search.query.QueryParams;
import net.yacy.search.query.SearchEvent; import net.yacy.search.query.SearchEvent;
import net.yacy.search.query.SearchEventCache; import net.yacy.search.query.SearchEventCache;
import net.yacy.search.query.SnippetProcess;
import net.yacy.search.ranking.RankingProfile; import net.yacy.search.ranking.RankingProfile;
import de.anomic.data.DidYouMean; import de.anomic.data.DidYouMean;
import de.anomic.data.UserDB; import de.anomic.data.UserDB;
@ -717,7 +718,7 @@ public class yacysearch {
try { try {
Pattern.compile(urlmask); Pattern.compile(urlmask);
} catch ( final PatternSyntaxException ex ) { } catch ( final PatternSyntaxException ex ) {
Log.logWarning("SEARCH", "Illegal URL mask, not a valid regex: " + urlmask); SnippetProcess.log.logWarning("Illegal URL mask, not a valid regex: " + urlmask);
prop.put("urlmaskerror", 1); prop.put("urlmaskerror", 1);
prop.putHTML("urlmaskerror_urlmask", urlmask); prop.putHTML("urlmaskerror_urlmask", urlmask);
urlmask = ".*"; urlmask = ".*";
@ -726,7 +727,7 @@ public class yacysearch {
try { try {
Pattern.compile(prefermask); Pattern.compile(prefermask);
} catch ( final PatternSyntaxException ex ) { } catch ( final PatternSyntaxException ex ) {
Log.logWarning("SEARCH", "Illegal prefer mask, not a valid regex: " + prefermask); SnippetProcess.log.logWarning("Illegal prefer mask, not a valid regex: " + prefermask);
prop.put("prefermaskerror", 1); prop.put("prefermaskerror", 1);
prop.putHTML("prefermaskerror_prefermask", prefermask); prop.putHTML("prefermaskerror_prefermask", prefermask);
prefermask = ""; prefermask = "";

@ -240,7 +240,7 @@ public class PeerActions {
try { try {
synchronized (this.newsPool) {this.newsPool.enqueueIncomingNews(record);} synchronized (this.newsPool) {this.newsPool.enqueueIncomingNews(record);}
} catch (final Exception e) { } catch (final Exception e) {
Log.logSevere("YACY", "processPeerArrival", e); Network.log.logSevere("processPeerArrival", e);
} }
} }
} }

@ -787,15 +787,15 @@ public final class SeedDB implements AlternativeDomainNames {
// create a seed file which for uploading ... // create a seed file which for uploading ...
seedFile = File.createTempFile("seedFile",".txt", seedDB.myOwnSeedFile.getParentFile()); seedFile = File.createTempFile("seedFile",".txt", seedDB.myOwnSeedFile.getParentFile());
seedFile.deleteOnExit(); seedFile.deleteOnExit();
if (Log.isFine("YACY")) Log.logFine("YACY", "SaveSeedList: Storing seedlist into tempfile " + seedFile.toString()); if (Network.log.isFine()) Network.log.logFine("SaveSeedList: Storing seedlist into tempfile " + seedFile.toString());
final ArrayList<String> uv = storeSeedList(seedFile, true); final ArrayList<String> uv = storeSeedList(seedFile, true);
// uploading the seed file // uploading the seed file
if (Log.isFine("YACY")) Log.logFine("YACY", "SaveSeedList: Trying to upload seed-file, " + seedFile.length() + " bytes, " + uv.size() + " entries."); if (Network.log.isFine()) Network.log.logFine("SaveSeedList: Trying to upload seed-file, " + seedFile.length() + " bytes, " + uv.size() + " entries.");
log = uploader.uploadSeedFile(sb, seedFile); log = uploader.uploadSeedFile(sb, seedFile);
// test download // test download
if (Log.isFine("YACY")) Log.logFine("YACY", "SaveSeedList: Trying to download seed-file '" + seedURL + "'."); if (Network.log.isFine()) Network.log.logFine("SaveSeedList: Trying to download seed-file '" + seedURL + "'.");
final Iterator<String> check = downloadSeedFile(seedURL); final Iterator<String> check = downloadSeedFile(seedURL);
// Comparing if local copy and uploaded copy are equal // Comparing if local copy and uploaded copy are equal
@ -852,11 +852,11 @@ public final class SeedDB implements AlternativeDomainNames {
private static String checkCache(final ArrayList<String> uv, final Iterator<String> check) { private static String checkCache(final ArrayList<String> uv, final Iterator<String> check) {
if ((check == null) || (uv == null)) { if ((check == null) || (uv == null)) {
if (Log.isFine("YACY")) Log.logFine("YACY", "SaveSeedList: Local and uploades seed-list are different"); if (Network.log.isFine()) Network.log.logFine("SaveSeedList: Local and uploades seed-list are different");
return "Entry count is different: uv.size() = " + ((uv == null) ? "null" : Integer.toString(uv.size())); return "Entry count is different: uv.size() = " + ((uv == null) ? "null" : Integer.toString(uv.size()));
} }
if (Log.isFine("YACY")) Log.logFine("YACY", "SaveSeedList: Comparing local and uploades seed-list entries ..."); if (Network.log.isFine()) Network.log.logFine("SaveSeedList: Comparing local and uploades seed-list entries ...");
int i = 0; int i = 0;
while (check.hasNext() && i < uv.size()) { while (check.hasNext() && i < uv.size()) {
if (!((uv.get(i)).equals(check.next()))) return "Element at position " + i + " is different."; if (!((uv.get(i)).equals(check.next()))) return "Element at position " + i + " is different.";

@ -66,6 +66,8 @@ import de.anomic.data.WorkTables;
public class SnippetProcess { public class SnippetProcess {
public static Log log = new Log("SEARCH");
private final static int SNIPPET_WORKER_THREADS = Math.max(4, Runtime.getRuntime().availableProcessors() * 2); private final static int SNIPPET_WORKER_THREADS = Math.max(4, Runtime.getRuntime().availableProcessors() * 2);
// input values // input values
@ -594,7 +596,7 @@ public class SnippetProcess {
180, 180,
!this.query.isLocal()); !this.query.isLocal());
final long snippetComputationTime = System.currentTimeMillis() - startTime; final long snippetComputationTime = System.currentTimeMillis() - startTime;
Log.logInfo("SEARCH", "text snippet load time for " + page.url() + ": " + snippetComputationTime + ", " + (!snippet.getErrorCode().fail() ? "snippet found" : ("no snippet found (" + snippet.getError() + ")"))); log.logInfo("text snippet load time for " + page.url() + ": " + snippetComputationTime + ", " + (!snippet.getErrorCode().fail() ? "snippet found" : ("no snippet found (" + snippet.getError() + ")")));
if (!snippet.getErrorCode().fail()) { if (!snippet.getErrorCode().fail()) {
// we loaded the file and found the snippet // we loaded the file and found the snippet
@ -613,7 +615,7 @@ public class SnippetProcess {
if (this.deleteIfSnippetFail) { if (this.deleteIfSnippetFail) {
this.workTables.failURLsRegisterMissingWord(this.query.getSegment().termIndex(), page.url(), this.query.query_include_hashes, reason); this.workTables.failURLsRegisterMissingWord(this.query.getSegment().termIndex(), page.url(), this.query.query_include_hashes, reason);
} }
Log.logInfo("SEARCH", "sorted out url " + page.url().toNormalform(true, false) + " during search: " + reason); log.logInfo("sorted out url " + page.url().toNormalform(true, false) + " during search: " + reason);
return null; return null;
} }
} }

Loading…
Cancel
Save