2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
障害発生時のログの自動収集
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
テストをデバッグするときは、障害とテスト対象デバイスの基本的な状況を把握するために、常に一揃いのログが必要です。ソースには、logcat、Tradefed ホストログ、スクリーンショットなどがあります。
テスト作成者がこれらのログを取得する手間を省き、汎用的な手段でログを取得できるようにするため、Tradefed にはログの収集に役立つメカニズムが組み込まれています。
構成
障害発生時にログを自動的に収集するには、Tradefed コマンドラインに次のオプションを追加します。
--auto-collect LOGCAT_ON_FAILURE
or
--auto-collect SCREENSHOT_ON_FAILURE
使用可能な値の完全なリストを確認するには、AutoLogCollector をご覧ください。
また、logcat とスクリーンショットには、それぞれ直接的なフラグがあります。
--logcat-on-failure
and
--screenshot-on-failure
スイート モジュール(AndroidTest.xml)に関する注意事項
モジュールは、このオプションを AndroidTest.xml
で直接指定することはできませんが、代わりにモジュール コントローラを使用できます。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-03-26 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-03-26 UTC。"],[],[],null,["# Automated log on failure collection\n\nWhen debugging tests, a set of logs is always needed to get a basic picture of\nthe failure and the device under test.\nSources include: Logcat, Tradefed host log, screenshot, etc.\n\nIn order to make it generic and painless for any test writer to get those logs,\nTradefed has a built-in mechanism to help collecting them.\n\nConfiguration\n-------------\n\nTo automatically collect some logs on failure, you can add the following option\nto your Tradefed command line: \n\n --auto-collect LOGCAT_ON_FAILURE\n or\n --auto-collect SCREENSHOT_ON_FAILURE\n\nTo see the full list of possible values, checkout\n[AutoLogCollector](https://android.googlesource.com/platform/tools/tradefederation/+/android16-release/src/com/android/tradefed/device/metric/AutoLogCollector.java)\n\nFor convenience, logcat and screenshot each have a direct flag: \n\n --logcat-on-failure\n and\n --screenshot-on-failure\n\nNote on suite modules (AndroidTest.xml)\n---------------------------------------\n\nModules cannot direcly specify this option in the `AndroidTest.xml`, but they\ncan use a [module controller](/docs/core/tests/tradefed/testing/through-suite/module-controller)\ninstead."]]