如何解决导致我的 logcat 泛滥的问题:I/System.out:(HTTPLog)-Static:isSBSettingEnabled false

Posted

技术标签:

【中文标题】如何解决导致我的 logcat 泛滥的问题:I/System.out:(HTTPLog)-Static:isSBSettingEnabled false【英文标题】:How do I fix whatever is causing this to flood my logcat: I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false 【发布时间】:2015-05-20 21:35:48 【问题描述】:

我正在编写一个可以访问互联网的 android 应用。它运行没有错误,但是自从我将设备(三星 Galaxy S5)升级到 Android 5.0.1 后,当我的手机运行该应用程序时,我的 logcat 中充斥着以下消息:

05-20 16:05:35.514  23322-23440/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:35.514  23322-23440/scave.dvend I/System.out﹕ (HTTPLog)-Static: isShipBuild true
05-20 16:05:35.514  23322-23440/scave.dvend I/System.out﹕ (HTTPLog)-Thread-23345-153023149: SmartBonding Enabling is false, SHIP_BUILD is true, log to file is false, DBG is false
05-20 16:05:35.514  23322-23440/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:35.564  23322-23440/scave.dvend I/System.out﹕ Knox***UidStorageknox***Supported API value returned is false
05-20 16:05:36.184  23322-23440/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:37.784  23322-23634/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:37.884  23322-23634/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:38.034  23322-23634/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:38.164  23322-23634/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:38.404  23322-23634/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:38.544  23322-23634/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:38.774  23322-23634/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:38.864  23322-23634/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:39.084  23322-23634/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:39.204  23322-23634/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
...
05-20 16:05:46.334  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:46.364  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:46.404  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:46.454  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:46.514  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:46.554  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:46.604  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:47.964  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:48.644  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:48.674  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:48.694  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:48.704  23322-24029/scave.dvend I/System.out﹕ Knox***UidStorageknox***Supported API value returned is false
05-20 16:05:48.754  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:48.804  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:48.844  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:48.874  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:48.914  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:48.944  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:48.994  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:50.564  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:50.604  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:50.654  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:50.714  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:50.744  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:50.774  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:50.824  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:50.834  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:50.864  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:50.904  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:50.944  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:50.984  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.014  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.044  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.094  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.124  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.144  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.204  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.224  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.254  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.304  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.424  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.504  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.554  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.594  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.624  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.654  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.714  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.744  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:51.774  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:53.134  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:53.204  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:53.324  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:53.384  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:53.414  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:53.444  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:54.684  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:54.724  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-20 16:05:54.744  23322-24029/scave.dvend I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false

这是我的 logcat 外观的一个非常小样本。这甚至意味着什么?有没有办法将“isSBSettingEnabled”设置为 true 以使其关闭?

【问题讨论】:

我认为这是三星特有的。 不可能避免这个日志来填充我们的日志文件或控制台?没有想法? 我在使用谷歌地图实用程序时遇到了同样的问题....有什么办法解决吗? 此时您的应用正在执行什么网络操作?您的应用程序是否触发了太多网络请求? 【参考方案1】:

您可以使用正则表达式过滤器来隐藏充斥您日志的日志消息:

^((?!isSBSettingEnabled).)*$

您还可以使用| 隐藏多个违规日志。例如

^((?!isSBSettingEnabled|OtherLog|OtherLog2|Annoying Messages).)*$

【讨论】:

@anthonymonori,是的。它过滤以显示任何不包含字符串“isSBSettingEnabled”的日志消息。你的正则表达式框被选中了吗?否则过滤器不起作用。 建议通过隐藏输出/LogCat 窗口中的日志来解决 OPs 问题是一切,但不是一个合理的答案。答案应该集中在帮助 OP 解决手头的问题(为什么它首先被打印出来 - 专注于它在日志中所说的内容)而不是隐藏 OP 询问他们如何从日志中删除该消息。这就是这样做的。另一个答案仅在程序级别上执行完全相同的操作,并且需要在生成日志条目的每个活动上使用该行代码。可以这么说,这消除了在代码中使用鸭带的麻烦。 标记为答案,因为这是我为此找到的最非侵入性的解决方案。 @captainserious 虽然我明白你的意思,但这是 Android 世界。你通常只能在胶带和口香糖解决方案之间进行选择,真正解决问题的根源通常是不可能的。【参考方案2】:

您可能正在使用HttpUrlConnectionHttpsUrlConnection。也许您可以通过在相应连接上调用getClass() 来找出正在记录的类,然后使用Logger.getLogger("...").setLevel(Level.OFF); 将其关闭

另见Enable logging for JDK class programmatically

【讨论】:

最终记录器 httpLogger = Logger.getLogger(HttpURLConnection.class.getName ()); httpLogger.setLevel (Level.OFF);但不起作用。【参考方案3】:

如果您在三星设备上运行的应用程序上使用HttpLoggingInterceptor,只需将日志级别设置为正文,它将解决所有问题。像这样的东西应该可以正常工作:

HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);

【讨论】:

【参考方案4】:

Android 7.0 通过网络安全配置文件提供了更好的解决方案。 怎么用? 1. 在 res/xml 下添加网络安全配置文件。 2. 添加域配置并将 cleartextTrafficPermitted 设置为“true”。

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">your_domain.com</domain>
    </domain-config>
</network-security-config>

    将您的网络安全配置添加到应用程序下的 Android 清单文件中。

    <application
        android:name=".MyApplication"
        android:networkSecurityConfig="@xml/network_security_config">
    

【讨论】:

对我不起作用 - 但我使用 IP 地址代替域名。【参考方案5】:

解决方案:

添加你的application标签:

android:usesCleartextTraffic="true"

如下:

<application
    ....
    android:usesCleartextTraffic="true"
    ....>

【讨论】:

以上是关于如何解决导致我的 logcat 泛滥的问题:I/System.out:(HTTPLog)-Static:isSBSettingEnabled false的主要内容,如果未能解决你的问题,请参考以下文章

Logcat 被“发送垃圾邮件”,导致“输出过多无法处理”

切换活动时出现Logcat错误导致应用程序在按下按钮后崩溃

如何解决Android Studiot版本4.2.2的Logcat无法输出日志的问题

如何从 Logcat 隐藏 NativeCrypto 消息

为啥 LogCat 不告诉我的代码中的错误在哪里

Android Studio 4.1 中缺少 Logcat