1.2.0 permalink Arrow_down_16x16


Logging macros which delegate to a specific logging implementation. At
runtime a specific implementation is selected from, in order, Apache
commons-logging, log4j, and finally java.util.logging.

Logging levels are specified by clojure keywords corresponding to the
values used in log4j and commons-logging:
:trace, :debug, :info, :warn, :error, :fatal

Logging occurs with the log macro, or the level-specific convenience macros,
which write either directly or via an agent. For performance reasons, direct
logging is enabled by default, but setting the *allow-direct-logging* boolean
atom to false will disable it. If logging is invoked within a transaction it
will always use an agent.

The log macros will not evaluate their 'message' unless the specific logging
level is in effect. Alternately, you can use the spy macro when you have code
that needs to be evaluated, and also want to output the code and its result to
the debug log.

Unless otherwise specified, the current namespace (as identified by *ns*) will
be used as the log-ns (similar to how the java class name is usually used).
Note: your log configuration should display the name that was passed to the
logging implementation, and not perform stack-inspection, otherwise you'll see
something like "fn__72$impl_write_BANG__39__auto____81" in your logs.

Use the enabled? macro to write conditional code against the logging level
(beyond simply whether or not to call log, which is handled automatically).

You can redirect all java writes of System.out and System.err to the log
system by calling log-capture!. To rebind *out* and *err* to the log system
invoke with-logs. In both cases a log-ns (e.g., "com.example.captured")
needs to be specified to namespace the output.

Vars in clojure.contrib.logging