Install the SDK via Gradle, Maven, or SBT:
\nFor Gradle, add to your build.gradle
file:
// Make sure mavenCentral is there.\nrepositories {\n mavenCentral()\n}\n\n// Add Sentry's SDK as a dependency.\ndependencies {\n implementation 'io.sentry:sentry:7.3.0'\n}
To upload your source code to Sentry so it can be shown in stack traces, use our Gradle plugin.
\nbuildscript {\n repositories {\n mavenCentral()\n }\n}\n\nplugins {\n id \"io.sentry.jvm.gradle\" version \"4.2.0\"\n}\n\nsentry {\n // Generates a JVM (Java, Kotlin, etc.) source bundle and uploads your source code to Sentry.\n // This enables source context, allowing you to see your source\n // code as part of your stack traces in Sentry.\n includeSourceContext = true\n\n org = \"___ORG_SLUG___\"\n projectName = \"___PROJECT_SLUG___\"\n authToken = \"your-sentry-auth-token\"\n}
For Maven, add to your pom.xml
file:
<dependency>\n <groupId>io.sentry</groupId>\n <artifactId>sentry</artifactId>\n <version>7.3.0</version>\n</dependency>
To upload your source code to Sentry so it can be shown in stack traces, use our Maven plugin.
\n<build>\n <plugins>\n <plugin>\n <groupId>io.sentry</groupId>\n <artifactId>sentry-maven-plugin</artifactId>\n <version>0.0.2</version>\n <configuration>\n <!-- for showing output of sentry-cli -->\n <debugSentryCli>true</debugSentryCli>\n\n <!-- download the latest sentry-cli and provide path to it here -->\n <!-- download it here: https://github.com/getsentry/sentry-cli/releases -->\n <!-- minimum required version is 2.17.3 -->\n <sentryCliExecutablePath>/path/to/sentry-cli</sentryCliExecutablePath>\n\n <org>___ORG_SLUG___</org>\n\n <project>___PROJECT_SLUG___</project>\n\n <!-- in case you're self hosting, provide the URL here -->\n <!--<url>http://localhost:8000/</url>-->\n\n <!-- provide your auth token via SENTRY_AUTH_TOKEN environment variable -->\n <!-- you can find it in Sentry UI: Settings > Account > API > Auth Tokens -->\n <authToken>${env.SENTRY_AUTH_TOKEN}</authToken>\n </configuration>\n <executions>\n <execution>\n <phase>generate-resources</phase>\n <goals>\n <goal>uploadSourceBundle</goal>\n </goals>\n </execution>\n </executions>\n </plugin>\n </plugins>\n ...\n</build>
For SBT:
\nlibraryDependencies += \"io.sentry\" % \"sentry\" % \"7.3.0\"
To upload your source code to Sentry so it can be shown in stack traces, please refer to Manually Uploading Source Context.
\nConfigure Sentry as soon as possible in your application's lifecycle:
\nimport io.sentry.Sentry;\n\nSentry.init(options -> {\n options.setDsn(\"___PUBLIC_DSN___\");\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.setTracesSampleRate(1.0);\n // When first trying Sentry it's good to see what the SDK is doing:\n options.setDebug(true);\n});
Trigger your first event from your development environment by intentionally creating an error with the Sentry#captureException
method, to test that everything is working:
import java.lang.Exception;\nimport io.sentry.Sentry;\n\ntry {\n throw new Exception(\"This is a test.\");\n} catch (Exception e) {\n Sentry.captureException(e);\n}
If you're new to Sentry, use the email alert to access your account and complete a product tour.
\nIf you're an existing user and have disabled alerts, you won't receive this email.
\nYou can capture transactions using the SDK. For example:
\nimport io.sentry.ITransaction;\nimport io.sentry.Sentry;\nimport io.sentry.SpanStatus;\n\n// A good name for the transaction is key, to help identify what this is about\nITransaction transaction = Sentry.startTransaction(\"processOrderBatch()\", \"task\");\ntry {\n processOrderBatch();\n} catch (Exception e) {\n transaction.setThrowable(e);\n transaction.setStatus(SpanStatus.INTERNAL_ERROR);\n throw e;\n} finally {\n transaction.finish();\n}
For more information about the API and automatic instrumentations included in the SDK, visit the docs.
"} +{"key":"java","type":"language","doc_link":"https://docs.sentry.io/platforms/java/","name":"Java","aliases":[],"categories":["desktop","server"],"body":"Install the SDK via Gradle, Maven, or SBT:
\nFor Gradle, add to your build.gradle
file:
// Make sure mavenCentral is there.\nrepositories {\n mavenCentral()\n}\n\n// Add Sentry's SDK as a dependency.\ndependencies {\n implementation 'io.sentry:sentry:7.3.0'\n}
To upload your source code to Sentry so it can be shown in stack traces, use our Gradle plugin.
\nbuildscript {\n repositories {\n mavenCentral()\n }\n}\n\nplugins {\n id \"io.sentry.jvm.gradle\" version \"4.2.0\"\n}\n\nsentry {\n // Generates a JVM (Java, Kotlin, etc.) source bundle and uploads your source code to Sentry.\n // This enables source context, allowing you to see your source\n // code as part of your stack traces in Sentry.\n includeSourceContext = true\n\n org = \"___ORG_SLUG___\"\n projectName = \"___PROJECT_SLUG___\"\n authToken = \"your-sentry-auth-token\"\n}
For Maven, add to your pom.xml
file:
<dependency>\n <groupId>io.sentry</groupId>\n <artifactId>sentry</artifactId>\n <version>7.3.0</version>\n</dependency>
To upload your source code to Sentry so it can be shown in stack traces, use our Maven plugin.
\n<build>\n <plugins>\n <plugin>\n <groupId>io.sentry</groupId>\n <artifactId>sentry-maven-plugin</artifactId>\n <version>0.0.2</version>\n <configuration>\n <!-- for showing output of sentry-cli -->\n <debugSentryCli>true</debugSentryCli>\n\n <!-- download the latest sentry-cli and provide path to it here -->\n <!-- download it here: https://github.com/getsentry/sentry-cli/releases -->\n <!-- minimum required version is 2.17.3 -->\n <sentryCliExecutablePath>/path/to/sentry-cli</sentryCliExecutablePath>\n\n <org>___ORG_SLUG___</org>\n\n <project>___PROJECT_SLUG___</project>\n\n <!-- in case you're self hosting, provide the URL here -->\n <!--<url>http://localhost:8000/</url>-->\n\n <!-- provide your auth token via SENTRY_AUTH_TOKEN environment variable -->\n <!-- you can find it in Sentry UI: Settings > Account > API > Auth Tokens -->\n <authToken>${env.SENTRY_AUTH_TOKEN}</authToken>\n </configuration>\n <executions>\n <execution>\n <phase>generate-resources</phase>\n <goals>\n <goal>uploadSourceBundle</goal>\n </goals>\n </execution>\n </executions>\n </plugin>\n </plugins>\n ...\n</build>
For SBT:
\nlibraryDependencies += \"io.sentry\" % \"sentry\" % \"7.3.0\"
To upload your source code to Sentry so it can be shown in stack traces, please refer to Manually Uploading Source Context.
\nConfigure Sentry as soon as possible in your application's lifecycle:
\nimport io.sentry.Sentry;\n\nSentry.init(options -> {\n options.setDsn(\"___PUBLIC_DSN___\");\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.setTracesSampleRate(1.0);\n // When first trying Sentry it's good to see what the SDK is doing:\n options.setDebug(true);\n});
Trigger your first event from your development environment by intentionally creating an error with the Sentry#captureException
method, to test that everything is working:
import java.lang.Exception;\nimport io.sentry.Sentry;\n\ntry {\n throw new Exception(\"This is a test.\");\n} catch (Exception e) {\n Sentry.captureException(e);\n}
If you're new to Sentry, use the email alert to access your account and complete a product tour.
\nIf you're an existing user and have disabled alerts, you won't receive this email.
\nYou can capture transactions using the SDK. For example:
\nimport io.sentry.ITransaction;\nimport io.sentry.Sentry;\nimport io.sentry.SpanStatus;\n\n// A good name for the transaction is key, to help identify what this is about\nITransaction transaction = Sentry.startTransaction(\"processOrderBatch()\", \"task\");\ntry {\n processOrderBatch();\n} catch (Exception e) {\n transaction.setThrowable(e);\n transaction.setStatus(SpanStatus.INTERNAL_ERROR);\n throw e;\n} finally {\n transaction.finish();\n}
For more information about the API and automatic instrumentations included in the SDK, visit the docs.
"} diff --git a/public/_platforms/kotlin.json b/public/_platforms/kotlin.json index feb0309a60317..60fcdef5109d1 100644 --- a/public/_platforms/kotlin.json +++ b/public/_platforms/kotlin.json @@ -1 +1 @@ -{"key":"kotlin","type":"language","doc_link":"https://docs.sentry.io/platforms/kotlin/","name":"Kotlin","aliases":[],"categories":["mobile","desktop","server"],"body":"If you're interested in Android, head over to the Getting Started for that SDK instead. At its core, Sentry for Java provides a raw client for sending events to Sentry. If you use Spring Boot, Spring, Logback, JUL, or Log4j2, head over to our Getting Started for Sentry Java.\n
\nInstall the SDK via Gradle or Maven:
\nFor Gradle, add to your build.gradle
file:
// Make sure mavenCentral is there.\nrepositories {\n mavenCentral()\n}\n\ndependencies {\n implementation 'io.sentry:sentry:7.3.0'\n}
For Maven, add to your pom.xml
file:
<dependency>\n <groupId>io.sentry</groupId>\n <artifactId>sentry</artifactId>\n <version>7.3.0</version>\n</dependency>
Configure Sentry as soon as possible in your application's lifecycle:
\nimport io.sentry.Sentry\n\nSentry.init { options ->\n options.dsn = \"___PUBLIC_DSN___\"\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0\n // When first trying Sentry it's good to see what the SDK is doing:\n options.isDebug = true\n}
Trigger your first event from your development environment by intentionally creating an error with the Sentry#captureException
method, to test that everything is working:
import java.lang.Exception\nimport io.sentry.Sentry\n\ntry {\n throw Exception(\"This is a test.\")\n} catch (e: Exception) {\n Sentry.captureException(e)\n}
If you're new to Sentry, use the email alert to access your account and complete a product tour.
\nIf you're an existing user and have disabled alerts, you won't receive this email.
\nYou can capture transactions using the SDK. For example:
\nimport io.sentry.Sentry\nimport io.sentry.SpanStatus\n\n// A good name for the transaction is key, to help identify what this is about\nval transaction = Sentry.startTransaction(\"processOrderBatch()\", \"task\")\ntry {\n processOrderBatch()\n} catch (e: Exception) {\n transaction.throwable = e\n transaction.status = SpanStatus.INTERNAL_ERROR\n throw e\n} finally {\n transaction.finish();\n}
For more information about the API and automatic instrumentations included in the SDK, visit the docs.
If you're interested in Android, head over to the Getting Started for that SDK instead. At its core, Sentry for Java provides a raw client for sending events to Sentry. If you use Spring Boot, Spring, Logback, JUL, or Log4j 2, head over to our Getting Started for Sentry Java.\n
\nInstall the SDK via Gradle or Maven:
\nFor Gradle, add to your build.gradle
file:
// Make sure mavenCentral is there.\nrepositories {\n mavenCentral()\n}\n\ndependencies {\n implementation 'io.sentry:sentry:7.3.0'\n}
For Maven, add to your pom.xml
file:
<dependency>\n <groupId>io.sentry</groupId>\n <artifactId>sentry</artifactId>\n <version>7.3.0</version>\n</dependency>
Configure Sentry as soon as possible in your application's lifecycle:
\nimport io.sentry.Sentry\n\nSentry.init { options ->\n options.dsn = \"___PUBLIC_DSN___\"\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0\n // When first trying Sentry it's good to see what the SDK is doing:\n options.isDebug = true\n}
Trigger your first event from your development environment by intentionally creating an error with the Sentry#captureException
method, to test that everything is working:
import java.lang.Exception\nimport io.sentry.Sentry\n\ntry {\n throw Exception(\"This is a test.\")\n} catch (e: Exception) {\n Sentry.captureException(e)\n}
If you're new to Sentry, use the email alert to access your account and complete a product tour.
\nIf you're an existing user and have disabled alerts, you won't receive this email.
\nYou can capture transactions using the SDK. For example:
\nimport io.sentry.Sentry\nimport io.sentry.SpanStatus\n\n// A good name for the transaction is key, to help identify what this is about\nval transaction = Sentry.startTransaction(\"processOrderBatch()\", \"task\")\ntry {\n processOrderBatch()\n} catch (e: Exception) {\n transaction.throwable = e\n transaction.status = SpanStatus.INTERNAL_ERROR\n throw e\n} finally {\n transaction.finish();\n}
For more information about the API and automatic instrumentations included in the SDK, visit the docs.