timestamps with adb logcat

For me adb is a great tool to interact with your device.
Here’s how to overcome the default lack of timestamps

You can list devices currently connected to your dev box, run commands on an android device, copy files to/from a phone or view your devices logfile.

But – I do not (and probably never will) understand why on earth standard log does not provide a timestamp. Sure, a timestamp can be added easily.

But why is it omitted  in the first place – does it waste some space or could confuse someone?

Anyways – compare logcat with and without timestamps:

adb logcat

D/IccSmsInterfaceManager( 1205): [IccSmsInterfaceManager] disableGsmBroadcastRange
D/IccSmsInterfaceManager( 1205): [IccSmsInterfaceManager] Failed to remove cell broadcast subscription for MID range 4380 to 4382 from client com.android.cellbroadcastreceiver
W/ProcessCpuTracker( 720): Skipping unknown process pid 11146
W/ProcessCpuTracker( 720): Skipping unknown process pid 11149
W/ProcessCpuTracker( 720): Skipping unknown process pid 11150
W/ProcessCpuTracker( 720): Skipping unknown process pid 11153
I/SystemUpdateService( 1630): receiver: Intent { flg=0x14 cmp=com.google.android.gms/.update.SystemUpdateService$Receiver (has extras) }
D/SystemUpdateService( 1630): onStartCommand: intent: Intent { cmp=com.google.android.gms/.update.SystemUpdateService (has extras) }
I/SystemUpdateService( 1630): active receiver: enabled
I/SystemUpdateService( 1630): showing system update notification
I/ValidateNoPeople( 720): skipping global notification
V/SystemUpdateService( 1630): retry (wakeup: false) in 3599982 ms

Now, same log – but with timestamps:

adb logcat -v time

12-22 23:44:59.011 D/IccSmsInterfaceManager( 1205): [IccSmsInterfaceManager] disableGsmBroadcastRange
12-22 23:44:59.011 D/IccSmsInterfaceManager( 1205): [IccSmsInterfaceManager] Failed to remove cell broadcast subscription for MID range 4380 to 4382 from client com.android.cellbroadcastreceiver
12-22 23:44:59.289 W/ProcessCpuTracker( 720): Skipping unknown process pid 11146
12-22 23:44:59.290 W/ProcessCpuTracker( 720): Skipping unknown process pid 11149
12-22 23:44:59.290 W/ProcessCpuTracker( 720): Skipping unknown process pid 11150
12-22 23:44:59.291 W/ProcessCpuTracker( 720): Skipping unknown process pid 11153
12-22 23:45:00.043 I/SystemUpdateService( 1630): receiver: Intent { flg=0x14 cmp=com.google.android.gms/.update.SystemUpdateService$Receiver (has extras) }
12-22 23:45:00.072 D/SystemUpdateService( 1630): onStartCommand: intent: Intent { cmp=com.google.android.gms/.update.SystemUpdateService (has extras) }
12-22 23:45:00.075 I/SystemUpdateService( 1630): active receiver: enabled
12-22 23:45:00.076 I/SystemUpdateService( 1630): showing system update notification
12-22 23:45:00.085 I/ValidateNoPeople( 720): skipping global notification
12-22 23:45:00.093 V/SystemUpdateService( 1630): retry (wakeup: false) in 3599982 ms

A more verbose log output:

adb logcat -v long

[ 12-22 23:44:59.011 1205:14210 D/IccSmsInterfaceManager ]
[IccSmsInterfaceManager] disableGsmBroadcastRange

[ 12-22 23:44:59.011 1205:14210 D/IccSmsInterfaceManager ]
[IccSmsInterfaceManager] Failed to remove cell broadcast subscription for MID range 4380 to 4382 from client com.android.cellbroadcastreceiver

[ 12-22 23:44:59.289 720: 806 W/ProcessCpuTracker ]
Skipping unknown process pid 11146

[ 12-22 23:44:59.290 720: 806 W/ProcessCpuTracker ]
Skipping unknown process pid 11149

[ 12-22 23:44:59.290 720: 806 W/ProcessCpuTracker ]
Skipping unknown process pid 11150

[ 12-22 23:44:59.291 720: 806 W/ProcessCpuTracker ]
Skipping unknown process pid 11153

[ 12-22 23:45:00.043 1630: 1630 I/SystemUpdateService ]
receiver: Intent { flg=0x14 cmp=com.google.android.gms/.update.SystemUpdateService$Receiver (has extras) }

[ 12-22 23:45:00.072 1630: 1630 D/SystemUpdateService ]
onStartCommand: intent: Intent { cmp=com.google.android.gms/.update.SystemUpdateService (has extras) }

[ 12-22 23:45:00.075 1630:11170 I/SystemUpdateService ]
active receiver: enabled

[ 12-22 23:45:00.076 1630:11170 I/SystemUpdateService ]
showing system update notification

[ 12-22 23:45:00.085 720: 720 I/ValidateNoPeople ]
skipping global notification

[ 12-22 23:45:00.093 1630:11170 V/SystemUpdateService ]
retry (wakeup: false) in 3599982 ms

Personally i think this really a waste of precious space – but it might be usefull in some cases.

In case you want to correlate android logs with logs produced by lets say an application server you’re lost without the second or latter form of logcat.

You can find a great and more detailed adb logcat bootcamp on a blog post at xda-developers.
Happy coding,
volker

Advertisements

About javavolker71

when i do not write posts on this blog, don't work on or try to break my code i'm spending a reasonable amount of time
This entry was posted in adb, adb logcat, logging, timestamp and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s