Logcat
Learn more about the Sentry Logcat integration for the Android SDK.
Supported in Sentry's Android SDK version 6.17.0
and above.
Supported in Sentry Android Gradle Plugin version 3.5.0
and above.
The Sentry Logcat integration adds support for automatically reporting log calls above a minimum logging level as breadcrumbs. Any matching android.Log.*
calls inside your app package are captured as breadcrumbs, including android.Log.*
calls originating from bundled third party libraries.
To use the Logcat integration, add the Sentry Android Gradle plugin in build.gradle
:
app/build.gradle
plugins {
id "io.sentry.android.gradle" version "4.7.1"
}
Auto-instrumentation is enabled by default, so no further configuration is required. If you'd like to disable the Logcat instrumentation feature, or change the minimum log level the following options are provided:
app/build.gradle
import io.sentry.android.gradle.extensions.InstrumentationFeature
import io.sentry.android.gradle.instrumentation.logcat.LogcatLevel
sentry {
tracingInstrumentation {
enabled = true
logcat {
enabled = true
minLevel = LogcatLevel.WARNING
}
}
}
This snippet captures an intentional error, so you can test that everything is working once you've set it up:
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import io.sentry.Sentry
import android.util.Log
class MyActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Log.w("MyTag", "Warning message.")
Sentry.captureException(Exception("My Exception"))
}
}
Learn more about manually capturing an error or message in our Usage documentation.
To view and resolve the recorded message, log into sentry.io and open your project. Click on the error's title to open a page where you can see error details and mark errors as resolved.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").