Make maven’s surefire show stacktrace in console

A related problem that I found is that surefire in recent versions apparently sets trimStackTrace to true by default (rendering most stack trace in failed tests useless), which is quite inconvenient. Setting -DtrimStackTrace=false or defining <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <trimStackTrace>false</trimStackTrace> </configuration> </plugin> solved this.

How can I get a call stack listing in Perl?

You can use Devel::StackTrace. use Devel::StackTrace; my $trace = Devel::StackTrace->new; print $trace->as_string; # like carp It behaves like Carp’s trace, but you can get more control over the frames. The one problem is that references are stringified and if a referenced value changes, you won’t see it. However, you could whip up some stuff with … Read more

Log4j formatting: Is it possible to truncate stacktraces?

You can use a EnhancedPatternLayout in log4j to format your stacktraces. See http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/EnhancedPatternLayout.html, specifically the section about the “throwable” pattern in the pattern table. Note that support for the %throwable{n} support is rather new and requires at least log4j 1.2.16 (which is the latest at time of writing) For tracking purposes, this is the ticket … Read more

How to get result of console.trace() as string in javascript with chrome or firefox?

I’m not sure about firefox, but in v8/chrome you can use a method on the Error constructor called captureStackTrace. (More info here) So a hacky way to get it would be: var getStackTrace = function() { var obj = {}; Error.captureStackTrace(obj, getStackTrace); return obj.stack; }; console.log(getStackTrace()); Normally, getStackTrace would be on the stack when it’s … Read more