| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| AppScope/ | 06-May-2025 | - | 36 | 33 | ||
| entry/ | 06-May-2025 | - | 1,312 | 1,185 | ||
| hvigor/ | 06-May-2025 | - | 23 | 22 | ||
| screenshots/devices/ | 06-May-2025 | - | ||||
| .gitignore | D | 06-May-2025 | 143 | 12 | 11 | |
| README.md | D | 06-May-2025 | 503 | 16 | 8 | |
| README_zh.md | D | 06-May-2025 | 2.2 KiB | 60 | 45 | |
| build-profile.json5 | D | 06-May-2025 | 1 KiB | 42 | 41 | |
| hvigorfile.ts | D | 06-May-2025 | 800 | 18 | 1 | |
| hvigorw | D | 06-May-2025 | 2.1 KiB | 62 | 28 | |
| hvigorw.bat | D | 06-May-2025 | 2 KiB | 72 | 56 | |
| oh-package.json5 | D | 06-May-2025 | 821 | 26 | 25 | |
| ohosTest.md | D | 06-May-2025 | 1.3 KiB | 14 | 12 |
README.md
1# DFX - FaultLogger 2 3### Introduction 4 5This example illustrates how to obtain application fault information in eTS. 6 7### Usage 8 91. After the application is started, click **Simulate Fault**. In the displayed dialog box, select the fault type and click **OK** to create the fault scenario. 10 112. Restart the application, and click the corresponding button to obtain the desired fault log. 12 13### Constraints 14 15This sample can only be run on standard-system devices. The SDK version must be 3.2.11.9 or later. 16
README_zh.md
1# 故障日志获取 2 3### 介绍 4 5本示例使用了[@ohos.faultLogger](https://docs.openharmony.cn/pages/v4.1/zh-cn/application-dev/reference/apis-performance-analysis-kit/js-apis-faultLogger.md)接口,展示了在eTS中如何获取应用故障相关信息。 6 7### 效果预览 8|首页| 9|--------| 10 11 12使用说明: 131. 启动应用后,点击**构造异常**按钮,在弹窗中选择故障类型,点击确定可以构造异常场景; 142. 构造异常场景后,重新启动应用,点击下面不同的获取异常按钮可以获取到对应类型的异常日志并显示在页面文本框中。 15 16### 工程目录 17``` 18entry/src/main/ets/ 19|---common 20| |---FaultDialog.ets // 异常构造弹窗 21| |---TitleBar.ets // title 22|---model 23| |---Logger // 日志工具 24|---pages 25| |---Index.ets // 首页 26``` 27 28### 具体实现 29+ 创造应用故障场景,故障类型枚举值参考[FaultType](https://docs.openharmony.cn/pages/v4.1/zh-cn/application-dev/reference/apis-performance-analysis-kit/js-apis-faultLogger.md),源码参考[FaultDialog.ets](entry/src/main/ets/common/FaultDialog.ets): 30 + js_crash故障:通过数组访问越界构造; 31 + cpp_crash故障:通过调用不存在的Api接口构造; 32 + freeze_crash故障:通过代码产生死循环构造; 33+ 获取上述异常故障日志,源码参考[Index.ets](entry/src/main/ets/pages/Index.ets): 34 + 获取异常故障日志:使用faultLogger.query接口获取异常日志信息。 35 36### 相关权限 37 38不涉及。 39 40### 依赖 41 42不涉及。 43 44### 约束与限制 45 461. 本示例仅支持标准系统上运行,支持设备:RK3568; 47 482. 本示例已适配API version 9版本SDK,版本号:3.2.11.9 49 503. 本示例需要使用DevEco Studio 3.1 Beta2 (Build Version: 3.1.0.400 构建 2023年4月7日)及以上版本才可编译运行。 51 52### 下载 53如需单独下载本工程,执行如下命令: 54``` 55git init 56git config core.sparsecheckout true 57echo code/BasicFeature/DFX/FaultLogger/ > .git/info/sparse-checkout 58git remote add origin https://gitee.com/openharmony/applications_app_samples.git 59git pull origin master 60```