Skip to content

Configure log4j via leiningen hook without imposing log4j on your libraries' users

Notifications You must be signed in to change notification settings

roomkey/lein-log4c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# DEPRECATED
This project is deprecated.  The preferred way of controlling log levels
dynamically is to use leiningen's `injection` feature.  Here's an example
using injections with a "log4c" profile (in profiles.clj):

```
{
 :log4c {:dependencies [[log4j/log4j "1.2.17"]
                        [com.hotelicopter/log4c "3.0.0"]]
         :injections [(require 'log4c.core)
                      (log4c.core/init!)
                      (log4c.core/configure! :CLJ_LOG_LEVEL)]}
}
```

# lein-log4c

This leingingen plugin allows you to configure log4j log levels
dynamically from the environment *without* requiring any production
dependency on log4j in your code. This approach is ideally suited for
library developers who don't want to impose a logging solution on
their library's clients.

Log levels are configured by namespace.

## Usage

First, include the plugin in your project or user profile:

  {:plugins [[com.roomkey/lein-log4c "1.5.0"]]}

Then simply specify the desired log levels with the CLJ_LOG_LEVEL environment
variable or JVM system property.  For example:

  CLJ_LOG_LEVEL=:warn,mylib.myns:debug lein test

The above will set the root logger to have a log level of WARN and the
mylib.myns namespace logger to have a level of DEBUG during the
execution of lein test task.

It's possible to override the specific version of log4j or log4c used by specifying the
desired version in the "log4c" profile:

  {:log4c {:dependencies [[log4j/log4j "1.2.17"]]}}

## License

Copyright (C) 2016 Roomkey

Distributed under the Eclipse Public License, the same as Clojure.

About

Configure log4j via leiningen hook without imposing log4j on your libraries' users

Resources

Stars

Watchers

Forks

Packages

No packages published