diff --git a/CHANGELOG.md b/CHANGELOG.md index 747bcf71..f42865dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 3.X.X (TBD) + +* Swallow Throwables thrown when configuring bugsnag appender + [#140](https://github.com/bugsnag/bugsnag-java/pull/140) + ## 3.4.5 (2019-04-04) * Migrate non-standard device fields to metaData.device diff --git a/bugsnag-spring/src/main/java/com/bugsnag/BugsnagSpringConfiguration.java b/bugsnag-spring/src/main/java/com/bugsnag/BugsnagSpringConfiguration.java index 74f7f8a6..0e3440c5 100644 --- a/bugsnag-spring/src/main/java/com/bugsnag/BugsnagSpringConfiguration.java +++ b/bugsnag-spring/src/main/java/com/bugsnag/BugsnagSpringConfiguration.java @@ -48,21 +48,26 @@ ScheduledTaskBeanLocator scheduledTaskBeanLocator() { * messages as they effectively duplicate error reports for unhandled exceptions. */ @PostConstruct + @SuppressWarnings("checkstyle:emptycatchblock") void excludeLoggers() { - // Exclude Tomcat logger when processing HTTP requests via a servlet. - // Regex specified to match the servlet variable parts of the logger name, e.g. - // the Spring Boot default is: - // [Tomcat].[localhost].[/].[dispatcherServlet] - // but could be something like: - // [Tomcat-1].[127.0.0.1].[/subdomain/].[customDispatcher] - BugsnagAppender.addExcludedLoggerPattern("org.apache.catalina.core.ContainerBase." - + "\\[Tomcat.*\\][.]\\[.*\\][.]\\[/.*\\][.]\\[.*\\]"); + try { + // Exclude Tomcat logger when processing HTTP requests via a servlet. + // Regex specified to match the servlet variable parts of the logger name, e.g. + // the Spring Boot default is: + // [Tomcat].[localhost].[/].[dispatcherServlet] + // but could be something like: + // [Tomcat-1].[127.0.0.1].[/subdomain/].[customDispatcher] + BugsnagAppender.addExcludedLoggerPattern("org.apache.catalina.core.ContainerBase." + + "\\[Tomcat.*\\][.]\\[.*\\][.]\\[/.*\\][.]\\[.*\\]"); - // Exclude Jetty logger when processing HTTP requests via the HttpChannel - BugsnagAppender.addExcludedLoggerPattern("org.eclipse.jetty.server.HttpChannel"); + // Exclude Jetty logger when processing HTTP requests via the HttpChannel + BugsnagAppender.addExcludedLoggerPattern("org.eclipse.jetty.server.HttpChannel"); - // Exclude Undertow logger when processing HTTP requests - BugsnagAppender.addExcludedLoggerPattern("io.undertow.request"); + // Exclude Undertow logger when processing HTTP requests + BugsnagAppender.addExcludedLoggerPattern("io.undertow.request"); + } catch (NoClassDefFoundError ignored) { + // logback was not in classpath, ignore throwable to allow further initialisation + } } }