Quieter Cascalog

Tonight I attended a meetup on Cascalog, a clojure DSL built on top of the Hadoop map-reduce framework. (Slides here and code here if you’d like to check it out yourself).

Running huge, complicated queries with a few lines of code was awesome, but my Hadoop installation made a lot of noise whenever I tried a query in the REPL using the ?<- query executor, printing lots of unwanted log info to stdout. (I was using Hadoop installed over homebrew instead of the readme recommendation). Fortunately, it’s easy to hush the logger a little by running queries inside cascalog.io/with-log-level. Here’s a quick two-line macro that wraps calls to ?<- in with-log-level to quiet down Hadoop:

  (require '[cascalog.io :refer [with-log-level]])
  (defmacro ?<-- [& forms] `(with-log-level :fatal (?<- ~@forms)))

For future reference, you can find a gist here.

Comments