Lower log level to warn for handled pack errors
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 <hugo.ares@ericsson.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
65423ea1b1
commit
d3a73c1407
|
@ -554,22 +554,31 @@ void selectObjectRepresentation(PackWriter packer, ObjectToPack otp,
|
|||
}
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue