LogCat中不会显示Log.d消息 [英] Logcat won't display Log.d messages

查看:1692
本文介绍了LogCat中不会显示Log.d消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个Android应用程序,我想有一些方法来打印调试语句作为我的code运行。幸运的是,logcat的是能够打印出来的时候我跑我的是Android 2.3.3(API 10)仿真程序Log.d消息。

I'm developing an Android application and I would like to have some way to print debug statements as my code runs. Fortunately for me, Logcat was able to print out Log.d messages when I run my application on an Android 2.3.3 (API 10) emulator.

然而,当我测试完全相同的应用程序中的物理设备上(三星Galaxy S4的Andr​​oid 4.2.2),我无法看到任何其他比dalvikvm和AndroidRuntime消息。

However, when I tested the same exact application on a physical device (Samsung Galaxy S4 Android 4.2.2) I was unable to see anything other than dalvikvm and AndroidRuntime messages.

com.android.internal.os.RuntimeInit <<<<<<
07-28 04:49:24.165: DEBUG/AndroidRuntime(6378): CheckJNI is OFF
07-28 04:49:24.165: DEBUG/AndroidRuntime(6378): setted country_code = USA
07-28 04:49:24.165: DEBUG/AndroidRuntime(6378): setted countryiso_code = US
07-28 04:49:24.175: DEBUG/AndroidRuntime(6378): setted sales_code = VZW
07-28 04:49:24.175: DEBUG/AndroidRuntime(6378): readGMSProperty: start
07-28 04:49:24.175: DEBUG/AndroidRuntime(6378): readGMSProperty: already setted!!
07-28 04:49:24.175: DEBUG/AndroidRuntime(6378): readGMSProperty: end
07-28 04:49:24.175: DEBUG/AndroidRuntime(6378): addProductProperty: start
07-28 04:49:24.185: DEBUG/dalvikvm(6378): Trying to load lib libjavacore.so 0x0
07-28 04:49:24.185: DEBUG/dalvikvm(6378): Added shared lib libjavacore.so 0x0
07-28 04:49:24.195: DEBUG/dalvikvm(6378): Trying to load lib libnativehelper.so 0x0
07-28 04:49:24.195: DEBUG/dalvikvm(6378): Added shared lib libnativehelper.so 0x0
07-28 04:49:24.385: DEBUG/AndroidRuntime(6378): Calling main entry com.android.commands.pm.Pm
07-28 04:49:26.978: DEBUG/AndroidRuntime(6378): Shutting down VM
07-28 04:49:26.988: DEBUG/dalvikvm(6378): GC_CONCURRENT freed 157K, 21% free 627K/788K, paused 1ms+0ms, total 4ms
07-28 04:49:26.988: DEBUG/jdwp(6378): Got wake-up signal, bailing out of select
07-28 04:49:26.988: DEBUG/dalvikvm(6378): Debugger has detached; object registry had 1 entries
07-28 04:49:27.458: DEBUG/AndroidRuntime(6420): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
07-28 04:49:27.458: DEBUG/AndroidRuntime(6420): CheckJNI is OFF
07-28 04:49:27.458: DEBUG/AndroidRuntime(6420): setted country_code = USA
07-28 04:49:27.458: DEBUG/AndroidRuntime(6420): setted countryiso_code = US
07-28 04:49:27.458: DEBUG/AndroidRuntime(6420): setted sales_code = VZW
07-28 04:49:27.458: DEBUG/AndroidRuntime(6420): readGMSProperty: start
07-28 04:49:27.458: DEBUG/AndroidRuntime(6420): readGMSProperty: already setted!!
07-28 04:49:27.458: DEBUG/AndroidRuntime(6420): readGMSProperty: end
07-28 04:49:27.458: DEBUG/AndroidRuntime(6420): addProductProperty: start
07-28 04:49:27.468: DEBUG/dalvikvm(6420): Trying to load lib libjavacore.so 0x0
07-28 04:49:27.478: DEBUG/dalvikvm(6420): Added shared lib libjavacore.so 0x0
07-28 04:49:27.478: DEBUG/dalvikvm(6420): Trying to load lib libnativehelper.so 0x0
07-28 04:49:27.478: DEBUG/dalvikvm(6420): Added shared lib libnativehelper.so 0x0
07-28 04:49:27.649: DEBUG/AndroidRuntime(6420): Calling main entry com.android.commands.am.Am
07-28 04:49:27.659: DEBUG/dalvikvm(6420): Note: class Landroid/app/ActivityManagerNative; has 169 unimplemented (abstract) methods
07-28 04:49:27.719: DEBUG/AndroidRuntime(6420): Shutting down VM
07-28 04:49:27.729: DEBUG/dalvikvm(6420): GC_CONCURRENT freed 157K, 20% free 666K/828K, paused 0ms+1ms, total 3ms
07-28 04:49:27.729: DEBUG/jdwp(6420): Got wake-up signal, bailing out of select
07-28 04:49:27.729: DEBUG/dalvikvm(6420): Debugger has detached; object registry had 1 entries

我不完全相信,因为LogCat中正在发生的事情是正确地瞄准我的物理设备,它显示了亚行的设备,而USB调试上。

I'm not exactly sure what is going on since Logcat is correctly targeting my physical device, it shows up on adb devices, and USB Debugging is on.

我已经使用Log.e尝试,但认为对输出没有任何影响。

I've tried using Log.e but that had no effect on the output.

我甚至设置的android:可调试=真,在AndroidManifest.xml中

I even set android:debuggable="true" in AndroidManifest.xml.

有我丢失的东西吗?我的物理设备上运行我的应用程序时,你为什么不LogCat中显示我的调试信息?

Is there something I'm missing here? Why won't Logcat display my debug messages when running my app on my physical device?

编辑:我试过了相同的应用程序上的Andr​​oid 4.2.2模拟器和logcat中按预期工作与模拟器,但仍然通过USB设备的问题logcat的。相反,一个正常的logcat打印输出的详细程度,我贴了块是我的详细日志级别唯一看到的。

I tried the same app on a Android 4.2.2 emulator and Logcat works as expected with the emulator, but there's still the problem with Logcat through the USB device. Instead of the verbosity of a normal Logcat printout, the block I posted is the only thing I see on the Verbose log level.

推荐答案

您需要通过亚行的shell设置日志记录(到预期的水平),如下所示:

You need to set logging (to the desired level) through the adb shell as follows:

  1. 导航到该平台的工具在你的Andr​​oid SDK文件夹。
  2. 使用打开亚行外壳 ./亚行外壳在Linux / MAC / Windows PowerShell或只是亚行外壳的窗口在cmd。
  3. 执行以下命令:

  1. Navigate to the platform-tools in your android sdk folder.
  2. Open the adb shell using ./adb shell for linux/mac/windows powershell or just adb shell for windows cmd.
  3. Issue the following commands:

 stop
 setprop log.tag.MYTAG VERBOSE
 start 

这篇关于LogCat中不会显示Log.d消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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