From 35e341370bd4495148ef00c97441ba2a5e85250a Mon Sep 17 00:00:00 2001 From: Ben Boyter Date: Fri, 22 Sep 2017 08:28:57 +1000 Subject: [PATCH] Add additional information to fine logs and extend size to 10000 records --- .../searchcode/app/jobs/repository/IndexGitRepoJob.java | 9 +++++---- .../java/com/searchcode/app/service/IndexService.java | 6 ++++-- src/main/java/com/searchcode/app/util/LoggerWrapper.java | 2 +- .../java/com/searchcode/app/util/LoggerWrapperTest.java | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/searchcode/app/jobs/repository/IndexGitRepoJob.java b/src/main/java/com/searchcode/app/jobs/repository/IndexGitRepoJob.java index 07037749..958ab7a7 100644 --- a/src/main/java/com/searchcode/app/jobs/repository/IndexGitRepoJob.java +++ b/src/main/java/com/searchcode/app/jobs/repository/IndexGitRepoJob.java @@ -94,15 +94,16 @@ public UniqueRepoQueue getNextQueuedRepo() { } @Override - public String getCodeOwner(List codeLines, String newString, String repoName, String fileRepoLocations, SearchcodeLib scl) { + public String getCodeOwner(List codeLines, String fileName, String repoName, String fileRepoLocations, SearchcodeLib scl) { List 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); } diff --git a/src/main/java/com/searchcode/app/service/IndexService.java b/src/main/java/com/searchcode/app/service/IndexService.java index 45f3015e..da852351 100644 --- a/src/main/java/com/searchcode/app/service/IndexService.java +++ b/src/main/java/com/searchcode/app/service/IndexService.java @@ -232,10 +232,11 @@ public synchronized void indexDocument(Queue 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 { @@ -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() + " " + @@ -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)); diff --git a/src/main/java/com/searchcode/app/util/LoggerWrapper.java b/src/main/java/com/searchcode/app/util/LoggerWrapper.java index 2897d209..0849a4cb 100644 --- a/src/main/java/com/searchcode/app/util/LoggerWrapper.java +++ b/src/main/java/com/searchcode/app/util/LoggerWrapper.java @@ -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() { diff --git a/src/test/java/com/searchcode/app/util/LoggerWrapperTest.java b/src/test/java/com/searchcode/app/util/LoggerWrapperTest.java index 2f91b7c7..e537a8fb 100644 --- a/src/test/java/com/searchcode/app/util/LoggerWrapperTest.java +++ b/src/test/java/com/searchcode/app/util/LoggerWrapperTest.java @@ -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() {