简体   繁体   English

从IntelliJ Idea复制堆栈跟踪

[英]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. 不幸的是,当前版本的IntelliJ Idea在调试器框架窗口中没有提供这样的功能。

You can use: 您可以使用:

  1. IDEA 2018.1 where "copy stack" action was finally introduced IDEA 2018.1最终引入了“复制堆栈”动作
  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 解决方案是添加一个特殊的监视(调试器的Variables窗口中的绿色+)

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) (你应该能够在Java 8中使用String.join()或在Android中使用TextUtils.join(delimiter,array))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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