gpt4 book ai didi

android - Fabric Crashlytics for android - 如何在 stackTrace 区域中包含附加信息

转载 作者:行者123 更新时间:2023-11-29 15:40:35 25 4
gpt4 key购买 nike

我想在 crashlytics 异常记录期间额外发送一个对象转储。因此,例如,假设发生了 nullPointerException。我想另外添加一个大对象,这将是我的模型,并将其包含在 crashlytics 的堆栈跟踪区域中。这样,当我看到堆栈跟踪时,我还可以从转储中查看模型信息。除了通常的 crashlytics 日志记录之外,我将如何发送此信息?这是我到目前为止所拥有的:

        try{
//....
throw new NullPointerException("my cool msg");

}
catch(Exception e){
Crashlytics.setInt("priority", 4);
Crashlytics.setString("tag", "mytag");
Crashlytics.setString("message", Model.toString());
Crashlytics.logException(e);
}

现在发生的是什么都没有出现。但是,如果我注释掉“消息”的 setString,那么我会得到一个带有消息“my cool msg”的堆栈跟踪。

更新:我什至尝试过 Crashlytics.log(Model.toString());但这在 crashlytics 上没有显示任何内容。我在 onCreate 中从 Application 子类设置 crashlytics,如下所示:Fabric.with(this, new Crashlytics());

我从 cashlytics 文档中找到了这个:

To make sure that sending crash reports has the smallest impact on your user’s devices, Crashlytics logs have a maximum size of 64 KB. When a log exceeds 64 KB, the earliest logged values will be dropped in order to maintain this threshold.

这可能是我的问题。现在检查我的尺码...

调整负载大小无效。我将有效负载设为 9 个字符,但仍然没有出现。

更新:

让我们重新开始,但更简单。为什么以下内容对我不起作用?

try{
//....
throw new NullPointerException("my cool msg");

}
catch(Exception e){
Crashlytics.setInt("priority", 4);
Crashlytics.setString("tag", "mytag");
Crashlytics.setString("message", "");
Crashlytics.logException(e);
}

这里发生的事情确实是一个堆栈跟踪出现在 crasylytics 仪表板中,上面写着“我的酷消息”,但没有关于优先级、标签或消息的任何信息。只有堆栈跟踪出现。应该有那里没有带有这些标题或其他内容的条目吗?

最佳答案

enter image description here

单击绿色的“查看所有 session ”按钮后,我能够看到自定义信息。他们本可以让它更明显。

也来自 docs似乎非致命异常被批处理并在下次应用启动时发送:

Crashlytics processes exceptions on a dedicated background thread, so the performance impact to your app is minimal. To reduce your users’ network traffic, Crashlytics batches logged exceptions together and sends them the next time the app launches.

关于android - Fabric Crashlytics for android - 如何在 stackTrace 区域中包含附加信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41275615/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com