This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push:
new 8fa8cefb5b7 Add and improve logs in ACS bootstrap process (#6890)
8fa8cefb5b7 is described below
commit 8fa8cefb5b70442f6057b69dd92f0cec9fe97508
Author: Stephan Krug <[email protected]>
AuthorDate: Fri Nov 3 08:55:38 2023 -0300
Add and improve logs in ACS bootstrap process (#6890)
* Add and improve logs
* Fix unnecessary calls
---------
Co-authored-by: Stephan Krug <[email protected]>
---
.../module/model/impl/DefaultModuleDefinitionSet.java | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 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 5dab5d7bd34..ec9bbc0cd97 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
@@ -97,16 +97,18 @@ public class DefaultModuleDefinitionSet implements
ModuleDefinitionSet {
@Override
public void with(ModuleDefinition def, Stack<ModuleDefinition>
parents) {
try {
- ApplicationContext context =
getApplicationContext(def.getName());
+ String moduleDefinitionName = def.getName();
+ log.debug(String.format("Trying to obtain module [%s]
context.", moduleDefinitionName));
+ ApplicationContext context =
getApplicationContext(moduleDefinitionName);
try {
Runnable runnable = context.getBean("moduleStartup",
Runnable.class);
- log.info("Starting module [" + def.getName() + "]");
+ log.info(String.format("Starting module [%s].",
moduleDefinitionName));
runnable.run();
} catch (BeansException e) {
- // Ignore
+ log.error(String.format("Failed to start module [%s]
due to: [%s].", moduleDefinitionName, e.getMessage()), e);
}
} catch (EmptyStackException e) {
- // The root context is already loaded, so ignore the
exception
+ log.error(String.format("Failed to obtain module context
due to [%s]. Using root context instead.", e.getMessage()), e);
}
}
});
@@ -117,10 +119,15 @@ public class DefaultModuleDefinitionSet implements
ModuleDefinitionSet {
@Override
public void with(ModuleDefinition def, Stack<ModuleDefinition>
parents) {
try {
+ String moduleDefinitionName = def.getName();
+ log.debug(String.format("Trying to obtain module [%s]
context.", moduleDefinitionName));
ApplicationContext parent =
getApplicationContext(parents.peek().getName());
+ log.debug(String.format("Trying to load module [%s]
context.", moduleDefinitionName));
loadContext(def, parent);
} catch (EmptyStackException e) {
- // The root context is already loaded, so ignore the
exception
+ log.error(String.format("Failed to obtain module context
due to [%s]. Using root context instead.", e.getMessage()), e);
+ } catch (BeansException e) {
+ log.error(String.format("Failed to load module [%s] due
to: [%s].", def.getName(), e.getMessage()), e);
}
}
});