> For the complete documentation index, see [llms.txt](https://docs.payments.thalescloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payments.thalescloud.io/nfc-wallet-sdk-android/ja/help/knowledge-base/retrieve-logs-from-an-android-device.md).

# Androidデバイスからログを取得する

## 概要

Android Debug Bridge (ADB) を使用してデバイスログ（`logcat`）をトラブルシューティング用に取得します。

制御された環境で問題を再現できる場合は、失敗するフローの直前から直後までのログを取得してください。

{% hint style="info" %}
アプリケーションサンドボックス内に留まる SDK のランタイムログが必要な場合は、代わりに `LogService` を使用してください。参照: [LogService でログを収集する](/nfc-wallet-sdk-android/ja/additional-features/collect-logs-with-secure-logger.md).
{% endhint %}

## 前提条件

Android デバイスからログファイルを取得する前に、次のセットアップを完了していることを確認してください:

* ホストマシンに Android Debug Bridge (ADB) をインストールします。
* 次を有効にします **USB デバッグ** テスト対象デバイスで
* USB ケーブルを使用して Android デバイスをホストマシンに接続します。
* 必要に応じて、Windows にデバイスの USB ドライバをインストールします。

セットアップを確認するには、次を実行します:

```bash
adb devices
```

ステータスが `device`:

```
接続されているデバイスの一覧
228b0e100d047ece device
```

デバイスが表示されない場合は、前提条件をもう一度確認してください。ADB のセットアップとトラブルシューティングについては、Android の公式ドキュメントを参照してください: [Android Debug Bridge (adb)](https://developer.android.com/tools/adb).

{% hint style="warning" %}
一部のデバイスでは、ベンダー固有のメニューでデバイスログを有効にする必要があります。

たとえば、Huawei の一部のデバイスでは、次をダイヤルしてメニューにアクセスできます `*#*#2846579#*#*`。参照してください [Huawei logcat で自分のアプリのログが表示されない](https://stackoverflow.com/questions/18124334/huawei-logcat-not-showing-the-log-for-my-app) を参照してください。
{% endhint %}

## ログを取得する（推奨）

1. デバイスのログバッファをクリアします:

   ```bash
   adb logcat -b all -c
   ```
2. ログの取得を開始します（ミリ秒タイムスタンプ、全優先度）:

   ```bash
   adb logcat -v threadtime -b all *:V > TestLogFileName.txt
   ```
3. お使いの環境で問題を再現します **デジタルウォレットアプリケーション**.
4. 取得を停止してファイルを回収します:
   * 押します `CTRL+C`.
   * 取得する `TestLogFileName.txt` を、コマンドを実行したフォルダーから取得します。

{% hint style="info" %}
最も詳細なログを得るには、NFC Wallet SDK を統合した **デジタルウォレットアプリケーション** のビルドを使用して再現します `dev` ビルド。

参照 [提供物](/nfc-wallet-sdk-android/ja/general/deliverables.md) サポートされているビルドタイプ向けに。

失敗するフローの周辺のみログを取得してください。手順の直前に開始し、直後に停止します。
{% endhint %}

{% hint style="warning" %}
避けてください [logcat フィルター](https://developer.android.com/studio/command-line/logcat#filteringOutput)。これらは、根本原因分析に必要な行を隠してしまうことがよくあります。
{% endhint %}

## セットアップの確認

たとえば SDK API を呼び出すフローを実行して、セットアップを確認できます **カード一覧を取得** 次に [デジタルカードを表示する](/nfc-wallet-sdk-android/ja/implement-nfc-wallet/manage-digital-cards/display-digital-cards.md#retrieve-card-list).

推奨コマンドでは、ログファイルに次の内容が含まれているはずです:

* 各行にミリ秒精度のタイムスタンプ。
* までのログ優先度の文字 `V` （Verbose）の PID と TID フィールドの後。
* 次の行を含むこと: `PublicAPI::Start of DigitalizedCardManager.getAllCards`.

次の例は、このような機能を示すログの抜粋です:

```
08-06 17:11:21.790 14171 14171 D SDK_ENTRY_POINT: PublicAPI::Start of DigitalizedCardManager.getAllCards
08-06 17:11:21.790 14171 14171 D SDK_ENTRY_POINT: PublicAPI::Start of SDKController.getInstance
08-06 17:11:21.791 14171 14171 D SDK_ENTRY_POINT: PublicAPI::Start of SDKController.getService
08-06 17:11:21.791 14171 14171 V util.h.xy.by.mb: 名前が DigitalizedCardBuinsessService のサービスの取得を試行中:
08-06 17:11:21.791 14171 14171 D util.h.xy.by.mb: business service = util.h.xy.l.a@f9a06e1
08-06 17:11:21.791 14171 14171 V util.h.xy.l.a: getAllCards が呼び出されました
08-06 17:11:21.791 14171 14171 D util.h.xy.aj.b: [DCM.getAllCards].increment
08-06 17:11:21.791 14171 14171 V util.h.xy.aj.b: [DCM.getAllCards] 残りの Ops は 1
08-06 17:11:21.792 14171 18982 I util.h.xy.n.mb: -----------------------------------------------------------------------GET_ALLCARDS-START----------------------------------------------------------------------

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.payments.thalescloud.io/nfc-wallet-sdk-android/ja/help/knowledge-base/retrieve-logs-from-an-android-device.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
