---
metadata:
  - name: generator
    content: Diplodoc Platform v5.66.0
alternate:
  - https://appmetrica.yandex.com/docs/en/sdk/android/analytics/android-logs.md
  - https://appmetrica.yandex.com/docs/ru/sdk/android/analytics/android-logs.md
  - https://appmetrica.yandex.com/docs/zh/sdk/android/analytics/android-logs.md
  - href: https://appmetrica.yandex.com/docs/zh/sdk/android/analytics/android-logs.md
    type: text/markdown
    title: Markdown version
  - href: https://appmetrica.yandex.com/docs/zh/llms.txt?revision=r21975373
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://appmetrica.yandex.com/docs/zh/llms.txt?revision=r21975373

# Logging

AppMetrica SDK 日志:

- SDK的激活。
- 从应用接收的事件。
- 发送到服务的事件。
- 事件已保存到本地数据库。
- 已发送到服务器的事件。
- 从本地数据库删除保存的事件。
- 各种可能影响库预期行为的错误和警告。

要使用 SDK 日志：

1. 在激活 SDK 时，使用扩展配置启用日志记录。

    {% list tabs group=instructions %}

    - Kotlin

      ```kotlin translate=no
      class YourApplication : Application() {
          override fun onCreate() {
              super.onCreate()
              // Creating an extended library configuration.
              val config = AppMetricaConfig.newConfigBuilder(API_KEY).build()
              // Initializing the AppMetrica SDK.
              AppMetrica.activate(this, config)
          }
      }
      ```

    - Java

      ```java translate=no
      public class YourApplication extends Application {
          @Override
          public void onCreate() {
              super.onCreate();
              // Creating an extended library configuration.
              AppMetricaConfig config = AppMetricaConfig.newConfigBuilder(API_KEY).build();
              // Initializing the AppMetrica SDK.
              AppMetrica.activate(this, config);
          }
      }
      ```

    {% endlist %}

2. 使用 adb 导出日志，运行 `adb logcat -v time >> ${PATH_TO_FILE}` 命令，或者在 Logcat IDE 中打开日志。

3. 如果需要，通过 AppMetricaAppMetrica` 标签过滤 ` SDK 日志。

<!-- source: zh/_includes/feedback-button-3.md -->
如果您没有找到所需答案，可以通过反馈表单提交您的问题。 请尽可能详细地描述问题。 如果可能，请附上截图。

<a href="../troubleshooting/feedback-new">
  <span class="button">联系支持</span>
</a>

<a href="../troubleshooting/feedback-docs">
  <span class="button">为文档提出改进建议</span>
</a>
<!-- endsource: zh/_includes/feedback-button-3.md -->
