@@ -97,16 +97,17 @@ protected void startContexts() {
9797 @ Override
9898 public void with (ModuleDefinition def , Stack <ModuleDefinition > parents ) {
9999 try {
100+ log .debug (String .format ("Trying to obtain module [%s] context." , def .getName ()));
100101 ApplicationContext context = getApplicationContext (def .getName ());
101102 try {
102103 Runnable runnable = context .getBean ("moduleStartup" , Runnable .class );
103- log .info ("Starting module [" + def .getName () + "]" );
104+ log .info (String . format ( "Starting module [%s]." , def .getName ()) );
104105 runnable .run ();
105106 } catch (BeansException e ) {
106- // Ignore
107+ log . error ( String . format ( "Failed to start module [%s] due to: [%s]." , def . getName (), e . getMessage ()), e );
107108 }
108109 } catch (EmptyStackException e ) {
109- // The root context is already loaded, so ignore the exception
110+ log . error ( String . format ( "Failed to obtain module context due to [%s]. Using root context instead." , e . getMessage ()), e );
110111 }
111112 }
112113 });
@@ -117,10 +118,14 @@ protected void loadContexts() {
117118 @ Override
118119 public void with (ModuleDefinition def , Stack <ModuleDefinition > parents ) {
119120 try {
121+ log .debug (String .format ("Trying to obtain module [%s] context." , def .getName ()));
120122 ApplicationContext parent = getApplicationContext (parents .peek ().getName ());
123+ log .debug (String .format ("Trying to load module [%s] context." , def .getName ()));
121124 loadContext (def , parent );
122125 } catch (EmptyStackException e ) {
123- // The root context is already loaded, so ignore the exception
126+ log .error (String .format ("Failed to obtain module context due to [%s]. Using root context instead." , e .getMessage ()), e );
127+ } catch (BeansException e ) {
128+ log .error (String .format ("Failed to load module [%s] due to: [%s]." , def .getName (), e .getMessage ()), e );
124129 }
125130 }
126131 });
0 commit comments