简体   繁体   中英

How can I get the call stack in Clojure?

I have a point in my clojure code where I want to know what the call stack was (ie: list of clojure functions used to get there). How can I do this?

This isn't the nicest solution, but it's simple and it should work in core clojure:

(try (throw (Exception. "")) (catch Exception e (.printStackTrace e *out*)))

You can inspect e in code if you want something other than a printed version. See also clojure.stacktrace in the current master branch or clj-stacktrace for clojure 1.2.

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