简体   繁体   中英

Copy stack trace from IntelliJ Idea

When the program has stopped at a breakpoint, I want to copy the current stack trace (the call stack) and paste it into a text file.

Unfortunately, the current version of IntelliJ Idea does not provide such functionality in the debugger frames window.

You can use:

  1. IDEA 2018.1 where "copy stack" action was finally introduced
  2. Export threads action from the frames view context menu
  3. Thread dump action from the left debugger toolbar

The solution is to add a special watch (the green + in the Variables window of the debugger), either

new Exception("debug").getStackTrace()

or

org.apache.commons.lang.StringUtils.join(new Exception("debug").getStackTrace(),"\n")

It is possible to copy (and paste as text) the value of such watch, and this value is the stack trace.

(You should be able to use String.join() in Java 8 or TextUtils.join(delimiter, array) in Android)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM