更新时间:2023-12-05 12:33:28
而不是尝试输出到控制台, Log
将输出到LogCat,您可以在Eclipse中找到: Window-> Show View->其他... - > Android-> LogCat
Rather than trying to output to the console, Log
will output to LogCat which you can find in Eclipse by going to: Window->Show View->Other…->Android->LogCat
看看参考日志
。
使用LogCat的好处是您可以根据日志类型打印不同的颜色,例如: Log.d
打印蓝色, Log.e
打印橙色。另外,您可以通过 日志标记 , 日志消息 , 过滤ID 和/或 应用程序名称 。当您只想看到应用程序的日志并将其他系统的内容分开时,这非常有用。
The benefits of using LogCat are that you can print different colours depending on your log type, e.g.: Log.d
prints blue, Log.e
prints orange. Also you can filter by log tag, log message, process id and/or by application name. This is really useful when you just want to see your app's logs and keep the other system stuff separate.