- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
接受的答案:
我不知道这是错误还是 Android 的特性。
我有一个调用 Log.d()
的应用程序,我会定期在我的设备上启动 logcat,通常它充满消息 - 大约 300kb/分钟,但有时它只是停止显示我的和大多数其他消息。我不知道可能是什么原因。
重启后一切正常。
奇怪的是,我使用了 Log.d()
,但是我的消息不在那里,但是日志中仍然包含一些其他罕见的 D
消息
public class AaaTest extends AndroidTestCase {
public void testA() throws Exception {
Log.wtf("foobar", "loggableE = " + Log.isLoggable("foobar", Log.ERROR));
Log.wtf("foobar", "loggableW = " + Log.isLoggable("foobar", Log.WARN));
Log.wtf("foobar", "loggableI = " + Log.isLoggable("foobar", Log.INFO));
Log.wtf("foobar", "loggableD = " + Log.isLoggable("foobar", Log.DEBUG));
Log.wtf("foobar", "loggableV = " + Log.isLoggable("foobar", Log.VERBOSE));
Log.e("foobar", "this is error");
Log.w("foobar", "this is warning");
Log.i("foobar", "this is info");
Log.d("foobar", "this is debug");
Log.v("foobar", "this is verbose");
Log.e("foobar", "this is error again");
Log.wtf("foobar", "this is wtf");
}
}
_
adb logcat -v threadtime "*:S" "foobar:V"
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
05-21 20:06:36.601 16052 16068 F foobar : loggableE = true
05-21 20:06:36.629 16052 16068 F foobar : loggableW = true
05-21 20:06:36.652 16052 16068 F foobar : loggableI = true
05-21 20:06:36.672 16052 16068 F foobar : loggableD = false
05-21 20:06:36.686 16052 16068 F foobar : loggableV = false
05-21 20:06:36.808 16052 16068 E foobar : this is error
05-21 20:06:36.808 16052 16068 E foobar : this is error again
05-21 20:06:36.809 16052 16068 F foobar : this is wtf
看起来 isLoggable()
完全不相关。
我的设备是 Zopo ZP300+ Android 4.0.4
最佳答案
Logcat 日志保存在 circular buffers 中,因此所有应用仅保留最后“N”(~256K)个字节。
如果您手机上的某些其他应用程序开始喷出日志并填满缓冲区,您可能会开始看到日志被丢弃。如果您过滤日志(按级别或 TAG),您可能看不到所有日志都用完了缓冲区。
您可以通过以下方式获取有关缓冲区大小和使用情况的统计信息
adb logcat -g
如果您将 logcat 输出通过管道传输到一个文件并 tail -f 该文件,您应该会看到大部分日志。
在 Mac/Linux 上,您可以在本地保存 logcat:
adb logcat -v long >> /tmp/logcat.txt &
然后检查它:
tail -f /tmp/logcat.txt
grep <some_regex> /tmp/logcat.txt
如果您发现某些应用程序正在生成大量日志,您可以考虑禁用或卸载该应用程序,看看是否有帮助。
其他一些需要研究的工具:
引用资料
关于android logger 自发地降低其冗长级别(不是 Eclipse),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23776242/
作为一个新人中的菜鸡,最近在看一个项目的代码其中有这么一段看得我很是费解 public class AssembleMsgService { private static Logger logger
我已更改 Gradle 构建脚本以使用 Spring 2.0.1 而不是 1.5.9。当我运行 gradle build 时,出现错误:找不到符号 Logger logger = Logger.get
这是我的示例代码: public class Logs { private static Logs logHandler; public static Logs handler() {
我目前正在使用 Java 日志记录。我有一个记录器 cwh.A 和 cwh.B。是否可以通过 Java 从记录器 cwh 获取这些记录器,而不知道它们的名称? 最佳答案 可以通过日志管理器获取所有记录
在我的应用程序中,有一次我将 java.util.logging 的根 Logger 及其所有处理程序设置为 Level.FINEST,如下所示: Logger.getLogger("").setLe
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭 7 年前。 Improv
我刚刚将 Java 插件升级到 1.7.0_25,这导致我几年前编写的一个小程序出现 fatal error (此后一直在维护)。 在小程序的 init() 方法的早期,我调用了 logger = L
logger.debug 和 logger.info 有什么区别? logger.debug什么时候打印? 最佳答案 我建议你看看这篇名为 "Short Introduction to log4j"
Fixed I tried reinstalling the plugin but that didn't work so i completely cleared my inteljii idea
我定义了一个记录器实例如下: private static final Logger LOGGER = Logger.getLogger(Main.class.getName()); 我有一个要记录的
我正在 Windows 下使用 Python 3.4.2。就我而言, import logging logger = logging.getLogger('logger') logger.setLev
我目前正在使用 C# 开发一个新的 Prism 项目,并想在我的 Bootstrapper 类中创建一个 NLog Logger。不幸的是,无论我做什么,它都拒绝构建,并告诉我... 'Logger.
我已经有几年没有使用 Log4J 了。我现在正在使用 org.jboss.logging 包在 JBoss 5 下开发一个应用程序。当我以前这样做时,将 logger.info() 消息包含在日志记录
ActiveRecord::Base.logger = Logger.new(STDOUT) 的 redis 等价物是什么?我想看看redis在做什么。 最佳答案 $redis.client.logg
我正在尝试使用 log4js 创建日志文件。完成所有配置后运行 Node app.js 时,我收到以下错误。 错误: TypeError: logger.setLevel is not a funct
我在一个拥有大约 50 多名开发人员的 IT 部门工作。它曾经有大约 100 多名开发人员,但由于经济衰退而被削减。 当我们的部门规模扩大时,我们雄心勃勃地努力建立一个特殊的架构小组。 这个小组决定做
我正在尝试找出跨多个模块使用 python 日志记录的最佳实践。我在这里看到:http://docs.python.org/2/howto/logging#logging-from-multiple-
我想将 Logger 注入(inject)到在 WildFly 10 上运行的 Maven 动态 Web 项目中的 bean 中。 我在 POM 中添加了依赖项。 WildFly 中提供了范围:
Java 9 引入了一个新的记录器,即 java.lang.System.Logger但我们总是有java.util.logging.Logger . 此记录器有什么新功能以及它有何改进? 最佳答案
我在 eclipse Mars 中配置了我的环境,但是 log4j 出现错误。我使用 spring 4 和 Maven 作为依赖管理器。部分代码: Eclipse 在这一行显示了一个错误,等于后的第二
我是一名优秀的程序员,十分优秀!