HarmonyOS 有没有崩溃日志上报收集功能?

如题:HarmonyOS 有没有崩溃日志上报收集功能?

阅读 481
1 个回答

请参考以下方案:

1、应用想要捕获js crash可以使用@ohos.app.ability.errorManager (ErrorManager)。ErrorManager模块提供对错误观察器的注册和注销的能力:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-app-ability-errormanager-V5

可以使用faultLogger通过其查询接口进行主动获取当前的故障信息:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-faultlogger-V5

hiAppEvent.addWatcher方法监听app crash:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-hiviewdfx-hiappevent-V5

2、参考三方库@hw-agconnect/ohos-apms:https://ohpm.openharmony.cn/\#/cn/detail/@hw-agconnect%2Fohos-apms