Skip to content
Peter Taoussanis edited this page Mar 6, 2024 · 2 revisions

Included appenders

Basic file appender

;; (:require [taoensso.timbre.appenders.core :as appenders]) ; Add to ns

(timbre/merge-config!
  {:appenders {:spit (appenders/spit-appender {:fname "/path/my-file.log"})}})

;; (timbre/merge-config! {:appenders {:spit {:enabled? false}}} ; To disable
;; (timbre/merge-config! {:appenders {:spit nil}}               ; To remove entirely

Carmine Redis appender

;; [com.taoensso/carmine <latest-version>] ; Add to project.clj deps
;; (:require [taoensso.timbre.appenders [carmine :as car-appender]]) ; Add to ns

(timbre/merge-config! {:appenders {:carmine (car-appender/carmine-appender)}})

This gives us a high-performance Redis appender:

  • All raw logging args are preserved in serialized form (even errors).
  • Configurable number of entries to keep per log level.
  • Only the most recent instance of each unique entry is kept.
  • Resulting log is just a Clojure value: a vector of log entries (maps).

Clojure has a rich selection of built-in and community tools for querying values like this.

See also car-appender/query-entries.

Postal email appender

;; [com.draines/postal <latest-version>] ; Add to project.clj deps
;; (:require [taoensso.timbre.appenders (postal :as postal-appender)]) ; Add to ns

(timbre/merge-config!
  {:appenders
   {:postal
    (postal-appender/postal-appender
      ^{:host "mail.isp.net" :user "jsmith" :pass "sekrat!!1"}
      {:from "[email protected]" :to "[email protected]"})}})

Community appenders

See community section.