I need to get the Android device timestamp in the format hh:mm:ss:SS. I am able to view the time displayed in the Logcat of Eclipse. Is it the computer's time or is it the Android device's time?
View your app logs To display the log messages for an app: Build and run your app on a device. Click View > Tool Windows > Logcat (or click Logcat in the tool window bar).
Logcat is a command-line tool that dumps a log of system messages, including stack traces when the device throws an error and messages that you have written from your app with the Log class. This page is about the command-line logcat tool, but you can also view log messages from the Logcat window in Android Studio.
Solution 1: Restarting your Android StudioIn your IDE Go to File > Invalidate Caches and Restart > Invalidate and Restart. This Solution will clear all the caches of Android studio IDE and restart it automatically, By the method, there are 80% change that Logcat will start work as before.
From the docs of logcat you can see that there is an option to specify how the output is formatted (-v).
To get a timestamp, you can use the command
logcat -v time
This will prefix each message with a timestamp.
use adb logcat -v threadtime
in terminal to take the logs from device, it will include date and time.
if you want to redirect these logs into a text file then use command in terminal.
adb logcat -v threadtime > folder_path_in_the_computer/filename.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With