clj-backtrace: more readable backtraces for Clojure

24 views
Skip to first unread message

Mark McGranaghan

unread,
Jan 1, 2009, 9:30:15 PM1/1/09
to Clojure
Hi all,

I'm happy to announce an alpha release of clj-backtrace, a library for
processing backtraces generated by Clojure programs. The library works
by separating useful backtrace information from the noise generated by
the Clojure compilation process, and also provides functions for
pretty-printing these cleaned backtraces.

You can see simple usage instructions and example backtrace output on
the library's README page:

http://github.com/mmcgrana/clj-backtrace/tree/master/README.textile

If you've ever felt that backtraces in Clojure were difficult to read,
I hope you'll give this library a try and let me know if it helps!

- Mark

Michael Reid

unread,
Jan 2, 2009, 4:10:09 PM1/2/09
to clo...@googlegroups.com
Hi,

I don't have Clojure in front of me right now to try this out, but
from the looks of the README let me be the first to give you an
emphatic *Thank you*.

This is looking rather useful. Nice work.

My one concern with this is how brittle is this with respect to
Clojure's development? Have you had any trouble getting reasonable
output on various revisions of Clojure?

/mike.

Mark McGranaghan

unread,
Jan 2, 2009, 5:58:30 PM1/2/09
to clo...@googlegroups.com
Hi Mike,

Thanks for your interest. clj-backtrace is developed and tested
against Clojure head, though it should work with reasonably recent
versions of Clojure. I hope that you and other Clojure users have a
chance to try it out in your environments and report the results back
to the group.

I wouldn't normally rely on the exposed implementation details like
clj-backtrace does, but these details are exactly the problem that the
library is trying to fix, so AFAIK there is no way around it. A patch
proving otherwise would of course be welcome.

Looking forward to your reports,
- Mark

Konrad Hinsen

unread,
Jan 3, 2009, 7:31:59 AM1/3/09
to clo...@googlegroups.com
On 02.01.2009, at 03:30, Mark McGranaghan wrote:

> I'm happy to announce an alpha release of clj-backtrace, a library for
> processing backtraces generated by Clojure programs. The library works
> by separating useful backtrace information from the noise generated by
> the Clojure compilation process, and also provides functions for
> pretty-printing these cleaned backtraces.

Thanks a lot, this is *very* useful.

I just wonder how it works. All I did is add the library to the
classpath and (use) it. That seems to be sufficient to change the
behaviour of code that was there before. Do you re-define any hooks?

Konrad.

Mark McGranaghan

unread,
Jan 3, 2009, 9:46:37 AM1/3/09
to clo...@googlegroups.com
Konrad,

Thanks for trying the library, I'm glad you found it useful. It should
not redefine any existing behaviour - could you share a REPL session
showing the behavior that seemed to change?

- Mark

On Jan 3, 2009, at 7:31 AM, Konrad Hinsen <konrad...@laposte.net>
wrote:

Konrad Hinsen

unread,
Jan 3, 2009, 11:55:45 AM1/3/09
to clo...@googlegroups.com
On 03.01.2009, at 15:46, Mark McGranaghan wrote:

> Thanks for trying the library, I'm glad you found it useful. It should
> not redefine any existing behaviour - could you share a REPL session
> showing the behavior that seemed to change?

Nothing except what the library is supposed to do: clean up the
backtrace printouts. I am wondering how a simple (use) can change the
way the backtrace is printed.

Konrad.

Mark McGranaghan

unread,
Jan 3, 2009, 12:58:29 PM1/3/09
to clo...@googlegroups.com
I'm still not sure how you are printing these backtraces.

For example, if I do:

user=> (use 'clj-backtrace.repl)
user=> ("foo")
user=> (.printStackTrace *e)

It prints the normal Java backtrace. If instead I do:

user=> (use 'clj-backtrace.repl)
user=> ("foo")
user=> (pst)

It prints the cleaned backtrace. Could you provide REPL sessions like
these that indicate the unexpected behavior?

- Mark

Konrad Hinsen

unread,
Jan 4, 2009, 6:03:17 AM1/4/09
to clo...@googlegroups.com
On 03.01.2009, at 18:58, Mark McGranaghan wrote:

> It prints the cleaned backtrace. Could you provide REPL sessions like
> these that indicate the unexpected behavior?

Sorry for the false alarm: I had used different shell scripts for
launching Clojure with and without your library, and I just
discovered that they also use different Clojure versions, one of them
being pretty old. That's the real cause for the differences I saw!

Konrad.

Paul Barry

unread,
Jan 4, 2009, 11:06:31 AM1/4/09
to clo...@googlegroups.com
This is very nice, any chance we could see this added to clojure contrib?

On Thu, Jan 1, 2009 at 9:30 PM, Mark McGranaghan <mmcg...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages