From d3a73c1407f8936cb45516da8d3a2d4dd43c6379 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hugo=20Ar=C3=A8s?= Date: Fri, 10 Apr 2015 09:08:07 -0400 Subject: [PATCH] Lower log level to warn for handled pack errors MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Pack not found and pack corrupted/invalid are handled by the code (pack is removed from the list) so logging an error and the stacktrace is misleading because it implies that there is an action to take to fix the error. Lower the log level to warn and remove the stacktrace for those 2 types of errors and keep the error log statement for any other. Change-Id: I2400fe5fec07ac6d6c244b852cce615663774e6e Signed-off-by: Hugo Arès Signed-off-by: Matthias Sohn --- .../storage/file/ObjectDirectory.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java index 687408e19d..9001dc349a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java @@ -554,22 +554,31 @@ public class ObjectDirectory extends FileObjectDatabase { } private void handlePackError(IOException e, PackFile p) { - String tmpl; + String warnTmpl = null; if ((e instanceof CorruptObjectException) || (e instanceof PackInvalidException)) { - tmpl = JGitText.get().corruptPack; + warnTmpl = JGitText.get().corruptPack; // Assume the pack is corrupted, and remove it from the list. removePack(p); } else if (e instanceof FileNotFoundException) { - tmpl = JGitText.get().packWasDeleted; + warnTmpl = JGitText.get().packWasDeleted; removePack(p); + } + if (warnTmpl != null) { + if (LOG.isDebugEnabled()) { + LOG.debug(MessageFormat.format(warnTmpl, + p.getPackFile().getAbsolutePath()), e); + } else { + LOG.warn(MessageFormat.format(warnTmpl, + p.getPackFile().getAbsolutePath())); + } } else { - tmpl = JGitText.get().exceptionWhileReadingPack; // Don't remove the pack from the list, as the error may be // transient. + LOG.error(MessageFormat.format( + JGitText.get().exceptionWhileReadingPack, p.getPackFile() + .getAbsolutePath()), e); } - LOG.error(MessageFormat.format(tmpl, - p.getPackFile().getAbsolutePath()), e); } @Override -- 2.39.5