Anyone using a stacktrace prettifier they can vouc...
# cfml-general
b
Anyone using a stacktrace prettifier they can vouch for?
I'm tired of QA engineers, support reps and PMs copying and pasting jumbled up stacktraces into tickets and Teams messages. Not that I expect more from them mind you; they are copying/pasting what the UI is giving them so it's on me. I believe I can, rather easily) format line breaks but I was hoping for some intelligent color-coding as well. We use something similar to this in some .NET apps. https://elmah.io/tools/stack-trace-formatter/ Notice that it can figure out that the last part of a dotted path is the method (and assumes everything else is the class), file paths are colored differently, line numbers, etc...
w
i've never seen one for cf but i'd certainly use it if when you create one. there's this: https://codebeautify.org/javaviewer and you can feed it an external url to autoformat it, but that seems like it puts an undue burden to always have those files publicly available: Load Java External URL in Browser URL like this https://codebeautify.org/javaviewer?url=external-url
https://codebeautify.org/javaviewer?url=https://gist.githubusercontent.com/cbmgit/bd80af18f75aaf981966b31760c1cd5a/raw/MyFirstProgram.java
but your .net one above seems snazzier
b
The .net one works nicely in the .net apps. It seems a basic one wouldn't be too difficult. Line breaks are easy enough... classpaths probably also not so bad. .?((\w+\.)+)(\w+\((.?)\)) ... $2 should be the dotted class path, $3 should be the method and args. Spotting absolute file paths, again, shouldn't be too difficult.
If I don't find a client side or java one, I might take a run at a module.
There's this but there are no demos/examples. https://github.com/StefanLiebenberg/html-exception-formatter
w
did you want a cf or a javascript solution?
b
When I started down the path, I was looking for server side but I suppose it doesn't matter
w
-based, that is
b
client side should work fine
s
We have error handling in place to present users with a short message and a UUID code that they can put in support requests -- and then we also email the full report to a standard mailbox, including that same UUID and a carefully formatted stacktrace and a lot of additional debug information about the request.
(more recently, we've started forwarding all logging to New Relic as well, so we can let it find patterns in log messages and usage -- and indicate anomalous behavior in our production apps)
b
We have error handling in place to present users with a short message and a UUID code that they can put in support requests
Same here and we have a web UI where support reps, qa, whoever can plug in those error codes and get error details. That's where I'm looking to better format stacks.
a carefully formatted stacktrace
Are you using anything special to format those or just some native string manipulation?
s
We take the underlying Java object apart and walk through the stack frames and format it based on that. We do a lot of Java-level stuff since CFML doesn't provide the level of control we want (and this puts it in line with our non-CFML apps).
👍 1
(well, we actually do it all in Clojure -- but it's basically Java interop)
b
I'm not sure what all you're wanting to pretty-fy in your stack traces, but the most common issue I have is simply the removal of line breaks. To fix that, I use a notepad replacement called metapad and replace
at
with
\n at
which basically puts a line break prior to all instance of a space followed by the word at. I'm sure most text editors with a find/replace can do that.