@@ -94,6 +94,7 @@ public static ClassLoader getClassLoader(final Class<?> class1, final Class<?> c
9494 LOGGER .trace ("Trying to find [{}] using context class loader {}." , resource , classLoader );
9595 final URL url = classLoader .getResource (resource );
9696 if (url != null ) {
97+ LOGGER .debug ("Found [{}] at {} using context class loader." , resource , url );
9798 return url ;
9899 }
99100 }
@@ -104,6 +105,7 @@ public static ClassLoader getClassLoader(final Class<?> class1, final Class<?> c
104105 LOGGER .trace ("Trying to find [{}] using {} class loader." , resource , classLoader );
105106 final URL url = classLoader .getResource (resource );
106107 if (url != null ) {
108+ LOGGER .debug ("Found [{}] at {} using {} class loader." , resource , url , classLoader );
107109 return url ;
108110 }
109111 }
@@ -112,6 +114,7 @@ public static ClassLoader getClassLoader(final Class<?> class1, final Class<?> c
112114 LOGGER .trace ("Trying to find [{}] using {} class loader." , resource , defaultLoader );
113115 final URL url = defaultLoader .getResource (resource );
114116 if (url != null ) {
117+ LOGGER .debug ("Found [{}] at {} using {} class loader." , resource , url , defaultLoader );
115118 return url ;
116119 }
117120 }
@@ -127,7 +130,11 @@ public static ClassLoader getClassLoader(final Class<?> class1, final Class<?> c
127130 // loader which the parent of the system class loader. Hence the
128131 // code below.
129132 LOGGER .trace ("Trying to find [{}] using ClassLoader.getSystemResource()." , resource );
130- return ClassLoader .getSystemResource (resource );
133+ final URL url = ClassLoader .getSystemResource (resource );
134+ if (url != null ) {
135+ LOGGER .debug ("Found [{}] at {} using system class loader." , resource , url );
136+ }
137+ return url ;
131138 }
132139
133140 /**
@@ -157,6 +164,7 @@ public static InputStream getResourceAsStream(final String resource, final Class
157164 LOGGER .trace ("Trying to find [{}] using context class loader {}." , resource , classLoader );
158165 is = classLoader .getResourceAsStream (resource );
159166 if (is != null ) {
167+ LOGGER .debug ("Found [{}] using context class loader {}." , resource , classLoader );
160168 return is ;
161169 }
162170 }
@@ -167,6 +175,7 @@ public static InputStream getResourceAsStream(final String resource, final Class
167175 LOGGER .trace ("Trying to find [{}] using {} class loader." , resource , classLoader );
168176 is = classLoader .getResourceAsStream (resource );
169177 if (is != null ) {
178+ LOGGER .debug ("Found [{}] using {} class loader." , resource , classLoader );
170179 return is ;
171180 }
172181 }
@@ -176,6 +185,7 @@ public static InputStream getResourceAsStream(final String resource, final Class
176185 LOGGER .trace ("Trying to find [{}] using {} class loader." , resource , defaultLoader );
177186 is = defaultLoader .getResourceAsStream (resource );
178187 if (is != null ) {
188+ LOGGER .debug ("Found [{}] using {} class loader." , resource , defaultLoader );
179189 return is ;
180190 }
181191 }
@@ -191,7 +201,11 @@ public static InputStream getResourceAsStream(final String resource, final Class
191201 // loader which the parent of the system class loader. Hence the
192202 // code below.
193203 LOGGER .trace ("Trying to find [{}] using ClassLoader.getSystemResource()." , resource );
194- return ClassLoader .getSystemResourceAsStream (resource );
204+ final InputStream is = ClassLoader .getSystemResourceAsStream (resource );
205+ if (is != null ) {
206+ LOGGER .debug ("Found [{}] using system class loader." , resource );
207+ }
208+ return is ;
195209 }
196210
197211 /**
0 commit comments