Skip to content

Commit 5e8b3fd

Browse files
AadvikAadvik
authored andcommitted
Use SLF4J logging for exception handling in WebComponentRegistrar
1 parent 1ca6b5b commit 5e8b3fd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

omod/src/main/java/org/openmrs/web/WebComponentRegistrar.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,16 @@
2222
import org.springframework.stereotype.Component;
2323
import org.springframework.web.context.ServletContextAware;
2424

25+
//Added
26+
import org.slf4j.Logger;
27+
import org.slf4j.LoggerFactory;
28+
2529
@Component
2630
public class WebComponentRegistrar implements ServletContextAware {
27-
31+
32+
//Added
33+
private static final Logger log = LoggerFactory.getLogger(WebComponentRegistrar.class);
34+
2835
@Override
2936
public void setServletContext(ServletContext servletContext) {
3037

@@ -61,7 +68,9 @@ public void setServletContext(ServletContext servletContext) {
6168
//This happens on running openmrs after InitializationFilter or UpdateFilter
6269
//hence requiring a restart to see any page other than index.htm
6370
//After a restart, all mappings will then happen within Listener.contextInitialized()
64-
ex.printStackTrace();
71+
72+
//Replaced
73+
log.error("Error registering web component", ex);
6574
}
6675
}
6776

0 commit comments

Comments
 (0)