From a6b570845f611ea7c83a2d0244b4ec31f52f54b9 Mon Sep 17 00:00:00 2001 From: dahn Date: Wed, 6 Dec 2023 12:12:54 +0100 Subject: [PATCH] lower level and no stack traces at info or higher (#8278) This PR reduces loglevel on non fatal errors and removes stacktraces above debug level. --- .../impl/DefaultModuleDefinitionSet.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/framework/spring/module/src/main/java/org/apache/cloudstack/spring/module/model/impl/DefaultModuleDefinitionSet.java b/framework/spring/module/src/main/java/org/apache/cloudstack/spring/module/model/impl/DefaultModuleDefinitionSet.java index ec9bbc0cd972..83d2feaa845f 100644 --- a/framework/spring/module/src/main/java/org/apache/cloudstack/spring/module/model/impl/DefaultModuleDefinitionSet.java +++ b/framework/spring/module/src/main/java/org/apache/cloudstack/spring/module/model/impl/DefaultModuleDefinitionSet.java @@ -105,10 +105,16 @@ public void with(ModuleDefinition def, Stack 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); + } } } }); @@ -125,9 +131,15 @@ public void with(ModuleDefinition def, Stack 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); + } } } });