From fe7085fb7531f15d03c6e7d743cdb2222cccbe61 Mon Sep 17 00:00:00 2001 From: Maciej Walkowiak Date: Mon, 23 Nov 2020 09:13:55 +0100 Subject: [PATCH 1/5] Upgrade Java version to 3.2.0 --- src/includes/getting-started-install/java.log4j2.mdx | 6 +++--- .../getting-started-install/java.spring-boot.mdx | 4 ++-- src/includes/getting-started-install/java.spring.mdx | 6 +++--- src/platforms/java/guides/logback/index.mdx | 4 ++-- .../java/guides/spring-boot/logging-frameworks.mdx | 4 ++-- src/platforms/java/usage.mdx | 10 +++++----- src/wizard/java/spring-boot.md | 8 ++++---- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/includes/getting-started-install/java.log4j2.mdx b/src/includes/getting-started-install/java.log4j2.mdx index 79404379550fe..3ed8b1197256e 100644 --- a/src/includes/getting-started-install/java.log4j2.mdx +++ b/src/includes/getting-started-install/java.log4j2.mdx @@ -2,16 +2,16 @@ io.sentry sentry-log4j2 - {{ packages.version('sentry.java', '3.1.1') }} + {{ packages.version('sentry.java', '3.2.0') }} ``` ```groovy {tabTitle:Gradle} -implementation 'io.sentry:sentry-log4j2:{{ packages.version('sentry.java', '3.1.1') }}' +implementation 'io.sentry:sentry-log4j2:{{ packages.version('sentry.java', '3.2.0') }}' ``` ```scala {tabTitle: SBT} -libraryDependencies += "io.sentry" % "sentry-log4j2" % "{{ packages.version('sentry.java', '3.1.1') }}" +libraryDependencies += "io.sentry" % "sentry-log4j2" % "{{ packages.version('sentry.java', '3.2.0') }}" ``` For other dependency managers see the [central Maven repository](https://search.maven.org/artifact/io.sentry/sentry-log4j2). diff --git a/src/includes/getting-started-install/java.spring-boot.mdx b/src/includes/getting-started-install/java.spring-boot.mdx index e2cd0f152a6e1..882a3bca27389 100644 --- a/src/includes/getting-started-install/java.spring-boot.mdx +++ b/src/includes/getting-started-install/java.spring-boot.mdx @@ -2,10 +2,10 @@ io.sentry sentry-spring-boot-starter - {{ packages.version('sentry.java', '3.1.1') }} + {{ packages.version('sentry.java', '3.2.0') }} ``` ```groovy {tabTitle:Gradle} -implementation 'io.sentry:sentry-spring-boot-starter:{{ packages.version('sentry.java', '3.1.1') }}' +implementation 'io.sentry:sentry-spring-boot-starter:{{ packages.version('sentry.java', '3.2.0') }}' ``` diff --git a/src/includes/getting-started-install/java.spring.mdx b/src/includes/getting-started-install/java.spring.mdx index f720cb94c7008..9eea5159d0892 100644 --- a/src/includes/getting-started-install/java.spring.mdx +++ b/src/includes/getting-started-install/java.spring.mdx @@ -2,16 +2,16 @@ io.sentry sentry-spring - {{ packages.version('sentry.java', '3.1.1') }} + {{ packages.version('sentry.java', '3.2.0') }} ``` ```groovy {tabTitle:Gradle} -implementation 'io.sentry:sentry-spring:{{ packages.version('sentry.java', '3.1.1') }}' +implementation 'io.sentry:sentry-spring:{{ packages.version('sentry.java', '3.2.0') }}' ``` ```scala {tabTitle: SBT} -libraryDependencies += "io.sentry" % "sentry-spring" % "{{ packages.version('sentry.java', '3.1.1') }}" +libraryDependencies += "io.sentry" % "sentry-spring" % "{{ packages.version('sentry.java', '3.2.0') }}" ``` For other dependency managers see the [central Maven repository](https://search.maven.org/artifact/io.sentry/sentry-spring). diff --git a/src/platforms/java/guides/logback/index.mdx b/src/platforms/java/guides/logback/index.mdx index 51148a8cb34d7..71e26e644654d 100644 --- a/src/platforms/java/guides/logback/index.mdx +++ b/src/platforms/java/guides/logback/index.mdx @@ -16,12 +16,12 @@ The source can be found [on GitHub](https://github.com/getsentry/sentry-java/tre io.sentry sentry-logback - {{ packages.version('sentry.java', '3.1.1') }} + {{ packages.version('sentry.java', '3.2.0') }} ``` ```groovy {tabTitle:Gradle} -implementation 'io.sentry:sentry-logback:{{ packages.version('sentry.java', '3.1.1') }}' +implementation 'io.sentry:sentry-logback:{{ packages.version('sentry.java', '3.2.0') }}' ``` ```scala {tabTitle: SBT} diff --git a/src/platforms/java/guides/spring-boot/logging-frameworks.mdx b/src/platforms/java/guides/spring-boot/logging-frameworks.mdx index 252b057a41d0f..aa748c22ebffd 100644 --- a/src/platforms/java/guides/spring-boot/logging-frameworks.mdx +++ b/src/platforms/java/guides/spring-boot/logging-frameworks.mdx @@ -14,12 +14,12 @@ To use Sentry Logback integration in Spring Boot application you must include a io.sentry sentry-logback - {{ packages.version('sentry.java', '3.1.1') }} + {{ packages.version('sentry.java', '3.2.0') }} ``` ```groovy {tabTitle:Gradle} -implementation 'io.sentry:sentry-logback:{{ packages.version('sentry.java', '3.1.1') }}' +implementation 'io.sentry:sentry-logback:{{ packages.version('sentry.java', '3.2.0') }}' ``` Minimum logging levels for `SentryAppender` can be configured in `application.properties` or `application.yml` file. diff --git a/src/platforms/java/usage.mdx b/src/platforms/java/usage.mdx index bbc2022f738d7..0c14255f80788 100644 --- a/src/platforms/java/usage.mdx +++ b/src/platforms/java/usage.mdx @@ -12,16 +12,16 @@ description: "Learn more about passing configuration options to a static Sentry# io.sentry sentry - 3.1.1 + 3.2.0 ``` ```groovy {tabTitle:Gradle} -implementation 'io.sentry:sentry:3.1.1' +implementation 'io.sentry:sentry:3.2.0' ``` ```scala {tabTitle:SBT} -libraryDependencies += "io.sentry" % "sentry" % "3.1.1" +libraryDependencies += "io.sentry" % "sentry" % "3.2.0" ``` For other dependency managers see the [central Maven repository](https://search.maven.org/artifact/io.sentry/sentry-spring). @@ -47,7 +47,7 @@ public class MyClass { // All events get assigned to the release. See more at // https://docs.sentry.io/workflow/releases/ - options.setRelease("io.sentry.samples.console@3.1.1+1"); + options.setRelease("io.sentry.samples.console@3.2.0+1"); // Modifications to event before it goes out. Could replace the event altogether options.setBeforeSend( @@ -103,7 +103,7 @@ fun main() { // All events get assigned to the release. See more at // https://docs.sentry.io/workflow/releases/ - it.release = "io.sentry.samples.console@3.1.1+1" + it.release = "io.sentry.samples.console@3.2.0+1" // Modifications to event before it goes out. Could replace the event altogether it.beforeSend = BeforeSendCallback { event: SentryEvent, hint: Any? -> diff --git a/src/wizard/java/spring-boot.md b/src/wizard/java/spring-boot.md index 68355b9d5ad55..5bad25c1f3696 100644 --- a/src/wizard/java/spring-boot.md +++ b/src/wizard/java/spring-boot.md @@ -15,12 +15,12 @@ Install the SDK via Maven or Gradle: io.sentry sentry-spring-boot-starter - {{ packages.version('sentry.java', '3.1.1') }} + {{ packages.version('sentry.java', '3.2.0') }} ``` ```groovy {tabTitle:Gradle} -implementation 'io.sentry:sentry-spring-boot-starter:{{ packages.version('sentry.java', '3.1.1') }}' +implementation 'io.sentry:sentry-spring-boot-starter:{{ packages.version('sentry.java', '3.2.0') }}' ``` ### Configure @@ -46,12 +46,12 @@ Add a dependency to `sentry-logback` module and Sentry Spring Boot Starter will io.sentry sentry-logback - {{ packages.version('sentry.java', '3.1.1') }} + {{ packages.version('sentry.java', '3.2.0') }} ``` ```groovy {tabTitle:Gradle} -implementation 'io.sentry:sentry-logback:{{ packages.version('sentry.java', '3.1.1') }}' +implementation 'io.sentry:sentry-logback:{{ packages.version('sentry.java', '3.2.0') }}' ``` ### Send First Event From 7f1dffff025e0ce37d713f2d663b6533221a8d09 Mon Sep 17 00:00:00 2001 From: Maciej Walkowiak Date: Mon, 23 Nov 2020 09:34:09 +0100 Subject: [PATCH 2/5] Update proxy docs (https://github.com/getsentry/sentry-java/pull/1035) --- src/platforms/java/common/configuration/index.mdx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/platforms/java/common/configuration/index.mdx b/src/platforms/java/common/configuration/index.mdx index ac8ff9c2db45f..a3a311e748ae4 100644 --- a/src/platforms/java/common/configuration/index.mdx +++ b/src/platforms/java/common/configuration/index.mdx @@ -170,7 +170,10 @@ See [Java Networking and Proxies](http://docs.oracle.com/javase/8/docs/technotes Alternatively, using Sentry options (only affects the Sentry HTTP client, useful inside shared application containers), -``` -http.proxy.host=proxy.example.com -http.proxy.port=8080 +```properties +http.host=proxy.example.com +# optional +http.port=8080 # default 80 +http.user=proxy-user +http.pass=proxy-password ``` From 4515f8833b825e2075f94b9ccd31e5a27c393f06 Mon Sep 17 00:00:00 2001 From: Maciej Walkowiak Date: Mon, 23 Nov 2020 09:59:45 +0100 Subject: [PATCH 3/5] Update Spring exception resolver order docs (https://github.com/getsentry/sentry-java/pull/1008) --- .../java.spring-boot.mdx | 11 +++++++++ .../getting-started-config/java.spring.mdx | 24 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/includes/getting-started-config/java.spring-boot.mdx b/src/includes/getting-started-config/java.spring-boot.mdx index 38eeced61172f..15f4269207e1c 100644 --- a/src/includes/getting-started-config/java.spring-boot.mdx +++ b/src/includes/getting-started-config/java.spring-boot.mdx @@ -11,6 +11,17 @@ sentry: dsn: ___PUBLIC_DSN___ ``` +By default, every unhandled exception is sent to Sentry, even those captured with `@ExceptionHandler` annotated methods. This behavior can be tuned through configuring `sentry.exception-resolver-order` property. For example, setting it to `2147483647` (the value of `org.springframework.core.Ordered#LOWEST_PRECEDENCE`) makes sure only exceptions that have not been handled by exception resolvers with higher order are sent to Sentry. + +```properties {filename:application.properties} +sentry.exception-resolver-order=2147483647 +``` + +```yaml {filename:application.yml} +sentry: + exception-resolver-order: 2147483647 +``` + We recommend using Sentry's Spring Boot integration with one of the [logging framework integrations](logging-frameworks/) as they work together seamlessly. To use Sentry **without** Spring Boot, we recommend using the [Sentry Spring integration](/platforms/java/guides/spring/). Once this integration is configured you can _also_ use Sentry’s static API, [as shown on the usage page](usage/), to record breadcrumbs, set the current user, or manually send events, for example. diff --git a/src/includes/getting-started-config/java.spring.mdx b/src/includes/getting-started-config/java.spring.mdx index 2494d43e49c63..c0fdfa71a7b73 100644 --- a/src/includes/getting-started-config/java.spring.mdx +++ b/src/includes/getting-started-config/java.spring.mdx @@ -22,3 +22,27 @@ class SentryConfiguration The DSN can be also provided through the system property `sentry.dsn`, environment variable `SENTRY_DSN` or the `dsn` property in `sentry.properties` file. [See the configuration page](/platforms/java/configuration/) for more details on external configuration. Once this integration is configured you can _also_ use Sentry’s static API, [as shown on the usage page](usage/), to record breadcrumbs, set the current user, or manually send events, for example. + +By default, every unhandled exception is sent to Sentry, even those captured with `@ExceptionHandler` annotated methods. This behavior can be tuned through configuring `exceptionResolverOrder` property on `@EnableSentry` annotation. For example, setting it to `Ordered.LOWEST_PRECEDENCE` makes sure only exceptions that have not been handled by exception resolvers with higher order are sent to Sentry. + +```java {tabTitle:Java} +import io.sentry.spring.EnableSentry; +import org.springframework.core.Ordered; +// NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry +// project/dashboard +@EnableSentry( + dsn = "___PUBLIC_DSN___", + exceptionResolverOrder = Ordered.LOWEST_PRECEDENCE +) +``` + +```kotlin {tabTitle:Kotlin} +import io.sentry.spring.EnableSentry +import org.springframework.core.Ordered; +// NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry +// project/dashboard +@EnableSentry( + dsn = "___PUBLIC_DSN___", + exceptionResolverOrder = Ordered.LOWEST_PRECEDENCE +) +``` From 121cae459cbd6a6891a7500486b9d0ed7ebb33cc Mon Sep 17 00:00:00 2001 From: Maciej Walkowiak Date: Mon, 23 Nov 2020 10:10:43 +0100 Subject: [PATCH 4/5] Update Java configuration. Fixes gh-725. --- .../java/common/configuration/index.mdx | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/platforms/java/common/configuration/index.mdx b/src/platforms/java/common/configuration/index.mdx index a3a311e748ae4..51fc19ccfd78e 100644 --- a/src/platforms/java/common/configuration/index.mdx +++ b/src/platforms/java/common/configuration/index.mdx @@ -36,6 +36,15 @@ Sentry.init(options -> { }); ``` +Whem multiple configuration ways are used, options are resolved in the following order: + +- system properties +- environment variables +- `sentry.properties` file which location is resolved from the system property `sentry.properties.file` +- `sentry.properties` file which location is resolved from the environment `SENTRY_PROPERTIES_FILE` +- `sentry.properties` located in the root of the classpath +- options provided in Java code + ## Configuration methods {#configuration-methods} There are multiple ways to configure the Java SDK, but all of them take the same options. See below for how to use each configuration method and how the option names might differ between them. @@ -80,20 +89,6 @@ System Environment Variable option names require that you replace the `.` with ` SENTRY_ENVIRONMENT=production java -jar app.jar ``` -### Configuration via code - -The DSN itself can also be configured directly in code: - -```java -import io.sentry.Sentry; - -Sentry.init(options -> { - options.setDsn("___PUBLIC_DSN___"); -}); -``` - -By passing a hardcoded DSN you are no longer able to override the DSN at runtime via Java System Properties or System Environment Variables. - ## Options The following options can all be configured as described above: via a `sentry.properties` file, via Java System Properties, via System Environment variables. From ea17fce3b3e7018a672436c9170fe955c621e76e Mon Sep 17 00:00:00 2001 From: Maciej Walkowiak Date: Mon, 23 Nov 2020 10:59:30 +0100 Subject: [PATCH 5/5] Update src/platforms/java/common/configuration/index.mdx Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> --- src/platforms/java/common/configuration/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/java/common/configuration/index.mdx b/src/platforms/java/common/configuration/index.mdx index 51fc19ccfd78e..e8a4ced0387e0 100644 --- a/src/platforms/java/common/configuration/index.mdx +++ b/src/platforms/java/common/configuration/index.mdx @@ -36,7 +36,7 @@ Sentry.init(options -> { }); ``` -Whem multiple configuration ways are used, options are resolved in the following order: +When multiple configuration ways are used, options are resolved in the following order: - system properties - environment variables