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
32
votes
4 answers

Print the name of the calling function to the debug log

Objective-C's runtime seems to be rather robust, so I was wondering if there's a way to log the name of the function that called the current function (for debugging purposes). My situation is that a bunch of things assign to a property, and rather…
Brian
  • 15,599
  • 4
  • 46
  • 63
32
votes
1 answer

Using promises - Logging stack trace in fail handler

I am rather new to nodejs so I will explain in a bit more detail what I am trying to do. I have a webserver. If a request fails I want to log the stack trace of that exception, but deliver a error page and not crash the server. As an example, the…
dave
  • 4,024
  • 2
  • 18
  • 34
31
votes
7 answers

How to display stack trace on a caught exception?

I have a generic function that prints exceptions (using log4j): private void _showErrorMessage(Exception e) { log.error(e.getClass() + ": " + e.getMessage() + ": " + e.getCause() + "\n" + e.getStackTrace().toString()); } Instead of seeing the…
ufk
  • 30,912
  • 70
  • 235
  • 386
31
votes
2 answers

Getting "ArrayIndexOutOfBoundsException: null" with NO stack trace

In our log files we find the following: [2012-09-24 00:09:32.590 +0000UTC] ERROR host server1 [] [] somepackage.someclass [] [Unknown] [V3rAqPaDvvAAAAExEXhdWGyh] [pjsQwTGHzxcAAAE5j4YdGvWV] "ThreadName" Some error happened: …
Christoph
  • 3,980
  • 2
  • 40
  • 41
31
votes
2 answers

Why does the Stack Trace shows my development files path?

Visual Studio 2010 SP1, compiled WCF app, put it on a server, and of course it got an error on the first run (what's new), outputted Stack Trace to log file. It's seeing the path to my development environment. Why? Is it because I deployed it as…
Rob Koch
  • 1,523
  • 3
  • 18
  • 26
30
votes
5 answers

How to throw exception without resetting stack trace?

This is a follow-up question to Is there a difference between “throw” and “throw ex”? is there a way to extract a new error handling method without resetting the stack trace? [EDIT] I will be trying both "inner method" and another answer provided by…
dance2die
  • 35,807
  • 39
  • 131
  • 194
30
votes
2 answers

Can one use libSegFault.so to get backtraces for SIGABRT?

The magic incantation LD_PRELOAD=/lib/libSegFault.so someapp runs someapp with libSegFault.so providing backtrace information on a SIGSEGV as described in many different places. Other than using signal(7)-like approaches to cause SIGABRT to invoke…
Rhys Ulerich
  • 1,242
  • 1
  • 12
  • 28
30
votes
5 answers

How to get a complete stack trace of a running java program that is taking 100% cpu?

I do have a jenkins instance that is stuck in some kind of endless loop without any visible activity. I can get the pid of the running process so how do I generate a trace that I can use for a bug report? I'm running on linux.
sorin
  • 161,544
  • 178
  • 535
  • 806
28
votes
5 answers

debug_backtrace() from registered shutdown function in PHP

While tinkering for an answer to this question, I found that debug_backtrace() doesn't trace beyond the function registered to register_shutdown_function(), when called from within it. This was mentioned in this comment for…
Dan Lugg
  • 20,192
  • 19
  • 110
  • 174
28
votes
1 answer

What's the difference between a stack-trace and a back-trace?

I really though I'd find an answer online, but I couldn't. Is there any difference at all? People say a 'backtrace' is generated upon something throwing an exception, while a stack trace is a list of method calls from the point when the application…
daremkd
  • 8,244
  • 6
  • 40
  • 66
28
votes
2 answers

Do not show file paths of build machine in stack trace

I am currently developing a C# application which has got it's own logging. When exceptions are thrown, the exception is saved into a list which can be viewed by the user via a list view. When the user clicks on a exception in the list view, the…
Emiswelt
  • 3,909
  • 1
  • 38
  • 56
27
votes
1 answer

Why do I lose stack trace when using async-await in Node.js?

When I run the following program async function functionOne() { throw new Error('Error here prints the complete stack'); await new Promise((resolve) => { setTimeout(() => { resolve(); }, 1000); }); } async function functionTwo() { …
27
votes
3 answers

what can lead throw to reset a callstack (I'm using "throw", not "throw ex")

I've always thought the difference between "throw" and "throw ex" was that throw alone wasn't resetting the stacktrace of the exception. Unfortunately, that's not the behavior I'm experiencing ; here is a simple sample reproducing my issue : using…
Brann
  • 31,689
  • 32
  • 113
  • 162
27
votes
7 answers

Error-logging for javascript on client side

My project which contains a lot of pages with forms. This is a backend of banking CRM system, so any error during working process is to be captured and investigated. On the server side we have enhanced java exceptions system, but if error occurs on…
shershen
  • 9,875
  • 11
  • 39
  • 60
26
votes
6 answers

How do you write a full stack trace to the log?

I was catching an exception and trying to write the stack trace to the logs like this: log.warn(e.getMessage()); But all it said was null So I changed it to log.warn(e.toString()); And now it says only java.lang.NullPointerException How do I…
Linc
  • 673
  • 2
  • 11
  • 16