Android的日志记录级别

编程入门 行业动态 更新时间:2024-10-24 12:20:41
本文介绍了Android的日志记录级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一点点困难配置的Andr​​oid日志记录。下面是我的code是这样的:

I'm having a little difficulty configuring Android logging. Here's what my code looks like:

if (Log.isLoggable("MY_TAG", Log.VERBOSE)) { Log.v("MY_TAG", "Here's a log message"); }

pretty的简单吧?

Pretty simple, right?

不过,我有相当多的困难得到了 Log.isLoggable(MY_TAG,Log.VERBOSE)返回true。

However, I'm having quite a bit of difficulty getting the Log.isLoggable("MY_TAG", Log.VERBOSE) to return true.

每developer.android/reference/android/util/Log.html,我尝试添加一个local.prop文件到/ data /目录,看起来像这样:

Per developer.android/reference/android/util/Log.html, I tried adding a local.prop file to the /data/ directory which looks like this:

log.tag.MY_TAG=VERBOSE

但没有运气。我也尝试过:

but no luck. I also tried:

System.setProperty("log.tag.MY_TAG", String.valueOf(Log.VERBOSE));

但是,这并不管用。

but that doesn't work either.

这是我在做什么错在这里的任何想法?我运行的是Android 2.1 UPDATE1上的Nexus 1,如果有什么差别。

Any ideas on what I'm doing wrong here? I'm running Android 2.1-update1 on a Nexus 1 if that makes any difference.

推荐答案

尝试

adb shell setprop log.tag.MyAppTag VERBOSE

更多推荐

Android的日志记录级别

本文发布于:2023-11-24 04:19:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1623945.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:级别   日志   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!