Posts

Showing posts with the label clojure

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 ...

Immutant (Part I): How To Install And Use With Noir

Immutant is the new player in the Clojure web development; not a framework but the first Clojure'esque application server. Let's see how well it fits in the Clojure ecosystem. Introduction If you have ever done any web project in Clojure , you certainly know about the dominance of Jetty in Clojure web development realm as almost all Clojure web frameworks ( Compojure , Noir , Moustache , ...) rely on Jetty to deliver their promises.  This is not bad at all: Jetty is a lightweight servlet container with a small memory footprint which serves you well for a usual CMS like website.  But if you need to use services like messaging or need to deploy your application to a context other than root or you want profiling, resource management and such, then Jetty may not be your best choice. But there's this new kid in town and he's one tough kid: Immutant .  It's basically JBoss AS7 along with clustering, caching, XA transactions, scheduled jobs and daemons packaged for C...