Skip to content

Commit

Permalink
lower level and no stack traces at info or higher (apache#8278)
Browse files Browse the repository at this point in the history
This PR reduces loglevel on non fatal errors and removes stacktraces above debug level.
  • Loading branch information
DaanHoogland authored Dec 6, 2023
1 parent a15b706 commit a6b5708
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,16 @@ public void with(ModuleDefinition def, Stack<ModuleDefinition> parents) {
log.info(String.format("Starting module [%s].", moduleDefinitionName));
runnable.run();
} catch (BeansException e) {
log.error(String.format("Failed to start module [%s] due to: [%s].", moduleDefinitionName, e.getMessage()), e);
log.warn(String.format("Failed to start module [%s] due to: [%s].", moduleDefinitionName, e.getMessage()));
if (log.isDebugEnabled()) {
log.debug(String.format("module start failure of module [%s] was due to: ", moduleDefinitionName), e);
}
}
} catch (EmptyStackException e) {
log.error(String.format("Failed to obtain module context due to [%s]. Using root context instead.", e.getMessage()), e);
log.warn(String.format("Failed to obtain module context due to [%s]. Using root context instead.", e.getMessage()));
if (log.isDebugEnabled()) {
log.debug("Failed to obtain module context: ", e);
}
}
}
});
Expand All @@ -125,9 +131,15 @@ public void with(ModuleDefinition def, Stack<ModuleDefinition> parents) {
log.debug(String.format("Trying to load module [%s] context.", moduleDefinitionName));
loadContext(def, parent);
} catch (EmptyStackException e) {
log.error(String.format("Failed to obtain module context due to [%s]. Using root context instead.", e.getMessage()), e);
log.warn(String.format("Failed to obtain module context due to [%s]. Using root context instead.", e.getMessage()));
if (log.isDebugEnabled()) {
log.debug("Failed to obtain module context: ", e);
}
} catch (BeansException e) {
log.error(String.format("Failed to load module [%s] due to: [%s].", def.getName(), e.getMessage()), e);
log.warn(String.format("Failed to start module [%s] due to: [%s].", def.getName(), e.getMessage()));
if (log.isDebugEnabled()) {
log.debug(String.format("module start failure of module [%s] was due to: ", def.getName()), e);
}
}
}
});
Expand Down

0 comments on commit a6b5708

Please sign in to comment.