How To Add Logging To A Clojure Project
When deploying a Clojure application in a production environment, it is necessary to have logging enabled to be able to, in case of any failure, track down the problem using the logs later. Clojure inhertis serveral logging frameworks from Java like Log4j and it has its own Clojure'esque wrapper around Java logging API called clojure.tools.logging . This HowTo will help you get started with a working “loggable” Clojure project. Though the instructions assume that you're using Leiningen for build automation, it can be applied to any Maven based build too. Setting Up A New Project This creates a new empty project: $ lein new app logger1 Generating a project called logger1 based on the 'app' template. Now edit project.clj to add required dependencies: (defproject logger1 "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url ...