Skip to content

Instantly share code, notes, and snippets.

@simon-brooke
Created September 11, 2016 14:29
Show Gist options
  • Save simon-brooke/ef714a924372168e8cb3f0d32d2c191c to your computer and use it in GitHub Desktop.
Save simon-brooke/ef714a924372168e8cb3f0d32d2c191c to your computer and use it in GitHub Desktop.
Getting Timbre v 4.x logging working
;; Taoensso.timbre has been a very good Clojure logging library, but v4.0 was a
;; breaking change and it took me a while to get my head round it, although in
;; fact it's very simple. If you're having trouble with it, try this, which is
;; very simple and works with Timbre 4.7.4
(ns ^{:doc "After upgrading Timbre from 3.x to 4.x, all my applications broke.
I wrote this little test piece to understand what was going wrong. It works."
:author "Simon Brooke"}
chainsaw.core
(:require
[taoensso.timbre :as timbre]
[taoensso.timbre.appenders.3rd-party.rotor :as rotor])
(:gen-class))
(def log-config
{:level :debug
:appenders
{:rotating (rotor/rotor-appender
{:path "chainsaw.log"
:max-size (* 512 1024)
:backlog 10})}})
(defn -main
"I don't do a whole lot ... yet."
[& args]
(timbre/merge-config! log-config)
(timbre/info "Chainsaw starting up")
(println "Hello, World!")
(timbre/info "Chainsaw shutting down"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment