CLojure logging has three options commons-logging, log4j-logging, java-logging and it picks them in that order according to availability as per the document specification . After looking at my sources it showed the same however the compiled version was a completley different order it started with java-logging. So I simply recompiled my contrib with ant to match the order i required as i couldn't remove java-logging.
clojure contrib logging to file
-
06-08-2022 - |
Question
Hi I have tried logging with clojure contrib but to no avail. Its clojure 1.1
(ns com.class.main.service
(:gen-class)
(:require (clojure.contrib [logging :as log])))
(log/info "Hello world")
I have put a log4j.jar file in my bin and a log4j.properties in the same directory as the log4j.jar.
Below is the log4j.properties conifguration
log4j.rootLogger=INFO, file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=H:\\log\\loging.log
log4j.appender.file.MaxFileSize=1MB
log4j.appender.file.MaxBackupIndex=1
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n*
I have gone through some basic examples although they are limited due to most using the newer version with tool.logging.
But below are the examples i have used
https://github.com/macourtney/Conjure/wiki/How-to-use-logging & http://www.paullegato.com/blog/setting-clojure-log-level/ have helped me get this far the log prints out on the console of emacs but i can't find a log file anywhere.
Solution 2
OTHER TIPS
I see that commenters have mentioned the excellent tools.logging
library. clojure.contrib.*
is deprecated code, and Clojure 1.1 is ancient. The toolset you are looking for, if it ever existed, is now long unmaintained and likely unsupported.
One option is to backport tools.logging
to Clojure 1.1 if you are stuck with 1.1 for some unfortunate reason. Otherwise, you should upgrade to Clojure 1.5.1 and then you can use the current libraries & post-contrib ecosystem.