Skip to content

Commit

Permalink
Merge branch 'main' into 6.x.x
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto committed Apr 26, 2022
2 parents 67a096c + c70fb8d commit 1ace4ce
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Sentry SDK for Java and Android

# Blog posts

* [Sentry’s Android Gradle Plugin Updated with Room Support and More](https://blog.sentry.io/2022/04/20/sentrys-android-gradle-plugin-updated-with-room-support-and-more/)
* [Troubleshooting Spring Boot applications with Sentry](https://blog.sentry.io/2022/04/18/troubleshooting-spring-boot-applications-with-sentry)
* [Android Manifest Placeholders](https://blog.sentry.io/2022/03/30/android-manifest-placeholders/)
* [UI Breadcrumbs for Android Error Events](https://blog.sentry.io/2022/02/08/ui-breadcrumbs-for-android-error-events)
* [Bytecode transformations: The Android Gradle Plugin](https://blog.sentry.io/2021/12/14/bytecode-transformations-the-android-gradle-plugin)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
package io.sentry.samples.servlet;

import io.sentry.Sentry;
import java.util.Set;
import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/** Initializes Sentry. */
public final class SentryInitializer implements ServletContainerInitializer {
@WebListener
public final class SentryInitializer implements ServletContextListener {

@Override
public void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletException {
public void contextInitialized(ServletContextEvent sce) {
Sentry.init(
options -> {
// NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in
// your Sentry project/dashboard
options.setDsn(
"https://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563");

// disables shutdown hook, as Sentry has to be closed on application undeploy.
options.setEnableShutdownHook(false);

// All events get assigned to the release. See more at
// https://docs.sentry.io/workflow/releases/
options.setRelease("io.sentry.samples.servlet@3.0.0+1");
Expand Down Expand Up @@ -54,4 +57,10 @@ public void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletExcepti
options.addInAppInclude("io.sentry.samples");
});
}

@Override
public void contextDestroyed(ServletContextEvent sce) {
Sentry.flush(5000);
Sentry.close();
}
}

This file was deleted.

0 comments on commit 1ace4ce

Please sign in to comment.