Android Tutorials - Herong's Tutorial Examples - Version 3.02, by Dr. Herong Yang
Viewing Activity Log File with "cat" Command in "adb shell"
This section provides a tutorial example on how to test ActivityLog application, find the log file with the 'adb shell' window, and view the log file content with the 'cat' shell command.
Continue from the previous tutorial, I did the following to test my ActivityLog application:
1. Build and install ActivityLog on my Android emulator using the Apache Ant tool.
2. Run the ActivityLog on the emulator. The "Activity created" message displayed on the screen. So the user interface behaves as I expected.
3. Run "adb shell" in a command window to find the log file, which should be located in the application's private file folder, /data/data/<package-name>/files, based what we learned from the previous chapter:
C:\herong>\local\android-sdk-windows\platform-tools\adb shell # cd /data/data/com.herongyang.activity/files cd /data/data/com.herongyang.activity/files # ls -l ls -l -rw-rw---- u0_a61 u0_a61 34 2015-03-01 22:46 Activity.log
4. Verify the log file content with "cat" shell command:
# cat Activity.log cat Activity.log Activity created ----------------
This confirms that ActivityLog has created the log file correctly. See a similar "adb shell" screenshot below:
Of course, you can delete the log file with "rm Activity.log" shell command, if needed.
See next tutorials on adding other activity callback methods to monitor the activity object lifecycle.
Last update: 2015.
Table of Contents