为什么 Log.d() 和 Log.v() 不打印 [英] Why are Log.d() and Log.v() not printing

查看:30
本文介绍了为什么 Log.d() 和 Log.v() 不打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的活动中有以下测试代码:

I have the following test code in my Activity:

@Override
public void onStart() {
    super.onStart();
    Log.e(CLASS_NAME, "ERROR onStart()");
    Log.w(CLASS_NAME, "WARN onStart()");
    Log.i(CLASS_NAME, "INFO onStart()");
    Log.d(CLASS_NAME, "DEBUG onStart()");
    Log.v(CLASS_NAME, "VERBOSE onStart()");

在 Android Studio 的 logcat 视图中,它只打印:

On the logcat view in Android Studio, it only prints:

02-10 15:56:10.190    6194-6194/org.example.my_app E/MyActivity﹕ ERROR onStart()
02-10 15:56:10.190    6194-6194/org.example.my_app W/MyActivity﹕ WARN onStart()
02-10 15:56:10.190    6194-6194/org.example.my_app I/MyActivity﹕ INFO onStart()

在框的顶部,菜单设置为Log level:Verbose",如果我进入旁边的菜单,选择Edit filter configuration"code>,by Log Level" 也设置为Verbose".为什么 Log.d()Log.v() 不打印任何东西?我可能缺少什么?任何建议将不胜感激.

On top of the box, the menu is set to Log level: "Verbose", and if I go into the menu next to it, choose "Edit filter configuration", "by Log Level" is also set to "Verbose". Why are the Log.d() and Log.v() not printing anything? What might I am missing? Any suggestions would be appreciated.

推荐答案

Android Studio 过滤已记录的行,但 Log 本身可能会在记录时过滤某些级别.参见 Log.isLoggable:

Android Studio filters lines that have already been logged but Log itself may filter some levels when logging. See Log.isLoggable:

任何标签的默认级别设置为INFO.

The default level of any tag is set to INFO.

(但是在许多手机上它实际上设置为 DEBUGVERBOSE.)

(However on many phone it is actually set to DEBUG or VERBOSE.)

这篇关于为什么 Log.d() 和 Log.v() 不打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆