How to view log messages on Android?
You don't need to run the application in debug mode to see the log messages.
To see the log messages you only need to enable usb debugging on your phone, adb drivers for your device, and a copy of Android developer tools. It looks like you have all of the above, so I'll suggest a few steps to fix this issue.
Don't use System.out.println
because it doesn't let you specify tag
. Make sure you set a good tag for your log messages. Once this is all confirmed, try to view the log message in eclipse logcat view mode. Create a filter with the tag you are using because many posts will print and it can be difficult to find yours. You can also filter the app using your app bundle name.
If you've tried all of this and you still can't see the log messages, try running:
adb kill-server
and
adb start-server
If you're out of luck, try restarting eclipse.
Confirm your device is connected!
If that doesn't work, you can also run ddms
from the sdk tools, which are a little more reliable.
Finally, if that doesn't work, you can simply issue adb logcat
on the command line. If you have multiple devices, you can list them with adb devices
and allow the device or emulator with -d for the only connected device
, -e for the emulator
or -s serialno
otherwise.
There are also tools that will allow you to view logs on your device, such as alogcat
source to share
If you are using Eclipse make sure:
- You have debugging enabled on your device (or you are using an emulator),
- The device is connected correctly - it should appear in the Devices view. If you don't have this view, select it from Window-> Show View-> Devices.
- You have selected your device in the device window (just click on it),
- You do not have a suspended LogCat and the filter is not enabled
All messages (no filters)
.
source to share