Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Line number in android log util

Is there any way to print file line number with android Log ?

enter image description here

like image 812
Mithun Sreedharan Avatar asked Oct 13 '11 05:10

Mithun Sreedharan


People also ask

How do you use log on Android?

To gather logs (logcat) from an android phone, follow either one of the following processes. Install Android SDK from http://developer.android.com/sdk/index.html. Make sure platform-tools is included (http://developer.android.com/sdk/installing/adding-packages.html). Enable USB Debugging on your device.


1 Answers

for getting line number `

public static int getLineNumber() {
    return Thread.currentThread().getStackTrace()[2].getLineNumber();
}
or 
Thread.currentThread().getStackTrace()[2].getLineNumber()
 in Log()

` try it will help u....

like image 52
Jigar Patel Avatar answered Oct 14 '22 21:10

Jigar Patel