我们在 AppCenter 上有一个 Android 应用程序,只要我们批准合并到
production
分支的拉取请求,就应该发布该应用程序。
我最近添加了广泛的日志记录来捕获一些错误,但在那之后,我们的版本在 AppCenter 版本部分中保留了几个小时,然后就消失了。日志旨在记录事件/错误。今天 9 个小时内,他们已经记录了 20 条日志,然后我们的发布就消失了。 (版本部分显示前一个版本为版本)但在记录的日志中,版本号显示它已经运行了几个小时。
出了什么问题?
我将该日志机制放在 UncaughtThreadHandler
内的应用程序类中,以便在 AppCenter 之前记录崩溃。也许他们有干扰?还是日志的property
太长?
我的日志样本:
val properties: HashMap<String?, String?> = object : HashMap<String?, String?>() {
init {
put("Situation", "contentList is null! Error in playing content: found nothing to play!")
put("Class Name", this.javaClass.name)
put("state.selectedStation?.title", state.selectedStation?.title)
put("state.selectedStation?.id", state.selectedStation?.id?.toString())
put("state.selectedStation?.genericMultiLangField1", state.selectedStation?.genericMultiLangField1)
put("Device Unique ID", (application as GeoMuseumApplication).deviceUniqueId)
put("User Chosen Language", SessionSettings.language)
put("LastAudioPlayedOnThisScreen", relativeHref)
put("state.selectedStation?.contentList.isNull ?", (state.selectedStation?.contentList == null).toString())
}
}
Crashes.trackError(NullPointerException("Cause: state.selectedStation?.contentList.isNullOrEmpty()"), properties, null)
问题是,当发生错误时,我们的代码某处陷入无限循环,无限次向 AppCenter 报告该错误,因此,AppCenter 将其识别为 DOS 攻击,并删除了该版本以及未来的相关日志。 一般来说,如果 AppCenter 检测到任何恶意活动,它会删除该版本。