Skip to content

Commit

Permalink
Add additional information to fine logs and extend size to 10000 records
Browse files Browse the repository at this point in the history
  • Loading branch information
boyter committed Sep 21, 2017
1 parent 031e6b3 commit 35e3413
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,16 @@ public UniqueRepoQueue getNextQueuedRepo() {
}

@Override
public String getCodeOwner(List<String> codeLines, String newString, String repoName, String fileRepoLocations, SearchcodeLib scl) {
public String getCodeOwner(List<String> codeLines, String fileName, String repoName, String fileRepoLocations, SearchcodeLib scl) {
List<CodeOwner> owners;
Timer timer = Singleton.getNewTimer();
Singleton.getLogger().fine("GIT Blame Info Time:start: " + fileName);
if (this.USE_SYSTEM_GIT) {
owners = this.getBlameInfoExternal(codeLines.size(), repoName, fileRepoLocations, newString);
owners = this.getBlameInfoExternal(codeLines.size(), repoName, fileRepoLocations, fileName);
} else {
owners = this.getBlameInfo(codeLines.size(), repoName, fileRepoLocations, newString);
owners = this.getBlameInfo(codeLines.size(), repoName, fileRepoLocations, fileName);
}
Singleton.getLogger().fine("GIT Blame Info Time: " + timer.toc());
Singleton.getLogger().fine("GIT Blame Info Time:end:" + fileName + ":" + timer.toc());

return scl.codeOwner(owners);
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/searchcode/app/service/IndexService.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,11 @@ public synchronized void indexDocument(Queue<CodeIndexDocument> codeIndexDocumen
Document document = this.buildDocument(x);

Timer timer = Singleton.getNewTimer();
this.logger.fine("indexDocument:updateDocument:start:linescount=" + x.getCodeLines() + ":filename=" + x.getRepoLocationRepoNameLocationFilename());
try {
writer.updateDocument(new Term(Values.PATH, x.getRepoLocationRepoNameLocationFilename()), facetsConfig.build(taxonomyWriter, document));
} catch (Exception ignored) {}
this.logger.fine("indexDocument:updateDocument:" + timer.toc());
this.logger.fine("indexDocument:updateDocument:end:filename=" + x.getRepoLocationRepoNameLocationFilename() + ":" + timer.toc());
});
}
finally {
Expand Down Expand Up @@ -272,6 +273,7 @@ public Document buildDocument(CodeIndexDocument codeIndexDocument) {
// This is the main pipeline for making code searchable and probably the most important
// part of the indexer codebase
Timer timer = Singleton.getNewTimer();
this.logger.fine("buildDocument:codeCleanPipeline:start:length=" + codeIndexDocument.getContents().length());
String indexContents = this.searchcodeLib.codeCleanPipeline(codeIndexDocument.getFileName()) + " " +
this.searchcodeLib.splitKeywords(codeIndexDocument.getFileName()) + " " +
codeIndexDocument.getFileLocationFilename() + " " +
Expand All @@ -280,7 +282,7 @@ public Document buildDocument(CodeIndexDocument codeIndexDocument) {
this.searchcodeLib.codeCleanPipeline(codeIndexDocument.getContents()) +
this.searchcodeLib.findInterestingKeywords(codeIndexDocument.getContents()) +
this.searchcodeLib.findInterestingCharacters(codeIndexDocument.getContents()).toLowerCase();
this.logger.fine("buildDocument:codeCleanPipeline:" + timer.toc());
this.logger.fine("buildDocument:codeCleanPipeline:end:length=" + indexContents.length() + ":" + timer.toc());

document.add(new TextField(Values.REPONAME, codeIndexDocument.getRepoName().replace(" ", "_"), Field.Store.YES));
document.add(new TextField(Values.REPO_NAME_LITERAL, this.helpers.replaceForIndex(codeIndexDocument.getRepoName()).toLowerCase(), Field.Store.NO));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/searchcode/app/util/LoggerWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public LoggerWrapper() {
this.severeRecentCache = EvictingQueue.create(1000);
this.searchLog = EvictingQueue.create(1000);
this.apiLog = EvictingQueue.create(1000);
this.fineRecentCache = EvictingQueue.create(1000);
this.fineRecentCache = EvictingQueue.create(10000);
}

public synchronized void clearAllLogs() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void testLoggerWrapperMemoryLeak() {
assertThat(logger.getWarningLogs().size()).isEqualTo(0);
assertThat(logger.getAllLogs().size()).isEqualTo(1000);
assertThat(logger.getSearchLogs().size()).isEqualTo(1000);
assertThat(logger.getFineLogs().size()).isEqualTo(1000);
assertThat(logger.getFineLogs().size()).isEqualTo(2100);
}

public void testLoggerWrapperGetLogReversed() {
Expand Down

0 comments on commit 35e3413

Please sign in to comment.