What's the current recommended way to produce static standalone executables? I see that the previously recomended tool caxa seems to have been archived.
See the first recommendation here: https://github.com/babashka/babashka/wiki/Self-contained-executable
Oh... sorry, I think I instinctively discarded that option when seeing the ".jar", thinking a JVM installation would be assumed... (I was originally looking at both plain clojure and babashka solutions, as startup times aren't necessarily a concern)
No JVM needed
bb uberjar will produce the uberjar for you
If I'm OK with losing the convenience of just calling bb on a program, how much performance am I sacrificing by using babashka, instead of building a native image with GraalVM? I see some mentions of differing performance characteristics between babashka and regular JVM or GraalVM and JVM, but not much between babashka vs GraalVM native image. (I guess the question is how much overhead there is for using SCI)
SCI will be a lot slower for hot loops, but for scripty programs it may not matter a lot. For longer running tasks it may matter. There are trade-offs. babashka generally uses lower memory than JVM but graalvm native images have both the good performance and low memory usage. So if you want the best of both worlds and are willing to build binaries yourself, go with native-image.
The best thing is to measure and then take action based on that.
Is there a way to change bundled logger format? If I understand correctly - Timbre & c.t.logging are both bundled but all logs go through Timbre eventually
If the goal is to change/add/remove targets and/or formats, I believe that can be done via timbre's *config* (https://taoensso.github.io/timbre/taoensso.timbre.html#var-*config* would probably be a starting point for info on that).
If the goal is to use a different implementation of a logging library, I would assume that it'd have the same caveats as any other library, e.g. the library to be included would have to be pure clojure (that can be loaded with SCI/bb) and rely only on java classes that are available in bb.
yea, it's the former - I want to see if I can make bb logs produce JSON rather than plain text - looks like a custom Timbre appender might be an option, I'll have a look
a really bodged slapdash example:
(ns bbs
(:require [taoensso.timbre :as log :refer [debug]]))
(log/swap-config! assoc-in [:appenders :println :fn]
(comp println
#(cheshire.core/generate-string % {:pretty true})
#(select-keys % [:instant :vargs])))
(debug {:a 1 :b 'xyz})
> bb src/bbs.clj
{
"instant" : "2025-05-19T18:09:45Z",
"vargs" : [ {
"a" : 1,
"b" : "xyz"
} ]
}nice one, thanks!