Questions tagged [stack-trace]

A report of the active stack frames at a certain point in time during the execution of a program.

A stack trace is a report of the active stack frames at a certain point in time during the execution of a program and is often referred to as a stack backtrace.

A stack trace is commonly used during interactive and post-mortem debugging. It typically lists all the functions awaiting return values on the stack at the time of the error. By examining what is on the stack and comparing it to what you expect, you can often determine how the error occurred. By inspecting the function containing the error, you may be able to edit and correct the problem.

A stack trace allows to track the sequence of nested functions called up to the point where the stack trace is generated. In a post-mortem scenario this is up to function where the failure occurred (but not necessarily is caused there). Sibling function calls are not visible in a stack trace.

Before you start

Please browse the list of frequently asked questions to see if your question is similar to one that has already been answered.

The tag should be used to mark questions related to generating, interpreting, debugging, or otherwise understanding stack traces.

2320 questions
132
votes
4 answers

Get __name__ of calling function's module in Python

Suppose myapp/foo.py contains: def info(msg): caller_name = ???? print '[%s] %s' % (caller_name, msg) And myapp/bar.py contains: import foo foo.info('Hello') # => [myapp.bar] Hello I want caller_name to be set to the __name__ attribute of…
Sridhar Ratnakumar
  • 81,433
  • 63
  • 146
  • 187
131
votes
5 answers

More than 10 lines in a node.js stack error?

Is there a way to get more than 10 lines in a node.js stack error? function a() { dieInHell(); } function b() { a(); } function c() { b(); } function d() { c(); } function e() { d(); } function f() { e(); } function g() { f(); } function h() { g();…
Julien Genestoux
  • 31,046
  • 20
  • 66
  • 93
130
votes
3 answers

Make maven's surefire show stacktrace in console

I'd like to see the stacktrace of unit tests in the console. Does surefire support this?
IAdapter
  • 62,595
  • 73
  • 179
  • 242
124
votes
4 answers

How to print full stack trace in exception?

For example, in one place... //---------------a try { // some network call } catch(WebException we) { throw new MyCustomException("some message ....", we); } ...and in another place... //--------------b try { // invoke code…
jojo
  • 13,583
  • 35
  • 90
  • 123
99
votes
2 answers

print python stack trace without exception being raised

Something is happening with one of my class's instance variables. I want to make the variable a property, and whenever it is accessed I want to print out the stack trace of all the code leading up to that point, so I can see where it's being messed…
Claudiu
  • 224,032
  • 165
  • 485
  • 680
92
votes
8 answers

C# equivalent to Java's Exception.printStackTrace()?

Is there a C# equivalent method to Java's Exception.printStackTrace() or do I have to write something myself, working my way through the InnerExceptions?
Epaga
  • 38,231
  • 58
  • 157
  • 245
92
votes
6 answers

Couldn't load memtrack module Logcat Error

I am getting an error Couldn't load memtrack module (No such file or directory) failed to load memtrack module: -2 at run time. StackTrace Error: E/SoundPool(1280) : error loading /system/media/audio/ui/Effect_Tick.ogg E/SoundPool(1280) …
Stephen
  • 9,899
  • 16
  • 90
  • 137
92
votes
5 answers

Xcode full stack trace

While debugging is there anyway to see a complete stack trace, list of methods called in main thread. Or any way to print them on command window.
NaXir
  • 2,373
  • 2
  • 24
  • 31
92
votes
4 answers

presentViewController: crash on iOS <6 (AutoLayout)

This is a weird crash I am getting. The crash happens when I press a button that goes to a certain ViewController. The line which it crashes on is: DestinationInformationViewController *info = [[DestinationInformationViewController alloc]…
MCKapur
  • 9,127
  • 9
  • 58
  • 101
90
votes
6 answers

How do I stop stacktraces truncating in logs

Lots of times in Java logs I'll get something like: Caused by: java.sql.BatchUpdateException: failed batch at org.hsqldb.jdbc.jdbcStatement.executeBatch(jdbcStatement.java:1102) at…
SCdF
  • 57,260
  • 24
  • 77
  • 113
90
votes
9 answers

How can one grab a stack trace in C?

I know there's no standard C function to do this. I was wondering what are the techniques to to this on Windows and *nix? (Windows XP is my most important OS to do this on right now.)
Kevin
  • 25,207
  • 17
  • 54
  • 57
84
votes
7 answers

How to log exceptions in Java?

There's a common problem I've come across a few times when logging exceptions in Java. There seem to be various different types to deal with. E.g. some wrap other exceptions and some don't have a message at all - only a type. Most code I've seen…
Steve Chambers
  • 37,270
  • 24
  • 156
  • 208
82
votes
3 answers

Is it possible to get a good stack trace with .NET async methods?

I have the following sample code setup in a WebApi application: [HttpGet] public double GetValueAction() { return this.GetValue().Result; } public async Task GetValue() { return await…
ChaseMedallion
  • 20,860
  • 17
  • 88
  • 152
77
votes
4 answers

How to read the full stacktrace in Java where it says e.g. "... 23 more"

I want to read the full stack trace of an exception that I capture. For example: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.ibm.db2.jcc.DB2Driver' at…
Enrique San Martín
  • 2,202
  • 7
  • 30
  • 51
75
votes
4 answers

How to read and understand the java stack trace?

For example, I got a stack trace like…
Toby D
  • 1,465
  • 1
  • 19
  • 31