4

I'm trying to print the logs in the screen. But it's showing an error that:

Unable to open stack trace file '/data/anr/traces.txt':Permission denied.

How can I access the stack trace file?

TryinHard
  • 4,078
  • 3
  • 28
  • 54
Prachi
  • 994
  • 5
  • 23
  • 36
  • Can you plz tell how you are trying to this I mean show some code – ingsaurabh Mar 10 '11 at 12:47
  • you can move that text file to your desktop(or any location) and you can open it no? – vnshetty Mar 10 '11 at 12:49
  • public void ReadLogs() { try { Process process = Runtime.getRuntime().exec("logcat -d"); BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(process.getInputStream())); StringBuilder log=new StringBuilder(); String line = bufferedReader.readLine(); while (line != null) { log.append(line); } Log_Details_button.setText(log.toString()); } catch (IOException e) { } } – Prachi Mar 10 '11 at 12:56
  • actually you dont have permission to that folder that's why in common practice this is not feasible unless you are root – ingsaurabh Mar 10 '11 at 13:14
  • okk..Then can u please help me out in how to get the logs and copy it to a new text file? – Prachi Mar 10 '11 at 13:19
  • Select a log then press Ctrl+A then Ctrl+C and paste in txt file – ingsaurabh Mar 10 '11 at 13:44

3 Answers3

1

All the stack trace is printed in the LogCat so go to DDMS window and select the LogCat tab.

If log cat is not visible select the device Tab from the DDMS and select your device on which you are testing.

If both the Tabs aren't visible to you then see the left bottom corner of Eclipse click on the + sign and select LogCat

TryinHard
  • 4,078
  • 3
  • 28
  • 54
ta54
  • 256
  • 1
  • 2
  • 8
  • Actually I am able to see the logcat in the eclipse screen. I am trying to print all the logs related to my application on the screen. How can I display all the logs related to my application in my application's screen? – Prachi Mar 10 '11 at 13:08
  • 1
    Hey Richa follow this link http://stackoverflow.com/questions/4242765/show-log-messages-on-screen-for-android-application – ta54 Mar 11 '11 at 04:35
0

i hope your using eclipse, you can find it in ddms window.

vnshetty
  • 20,051
  • 23
  • 64
  • 102
0
  1. Open your project in Android Studio
  2. From the Analyze menu, click Analyze Stack Trace or Thread Dump. It looks like this
  3. Paste the stack trace text into the Analyze Stack Trace window and click OK.Stack Trace Dialog
  4. Android Studio opens a new Stacktrace tab with the stack trace you pasted under the Run window.StackTrace Tab