https://github.com/luminus-framework/log4j-edn-config
EDN configuration plugin for log4j
https://github.com/luminus-framework/log4j-edn-config
Last synced: 6 months ago
JSON representation
EDN configuration plugin for log4j
- Host: GitHub
- URL: https://github.com/luminus-framework/log4j-edn-config
- Owner: luminus-framework
- License: other
- Created: 2016-07-06T13:47:39.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-10T22:21:50.000Z (almost 10 years ago)
- Last Synced: 2025-08-21T00:36:09.992Z (10 months ago)
- Language: Java
- Size: 17.6 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# log4j-edn-config
A Clojure library designed to provide EDN configuration support for log4j2
## Usage
[](https://clojars.org/log4j-edn-config)
**warning** Log4j has [a bug](https://issues.apache.org/jira/browse/LOG4J2-369) that makes plugins incompatible with compatible uberjars. Log4j generates a plugin dat file, and only a single file can be present on the classpath, when multiple ones are present, then you'll end up with unexpected behaviors. Maven provides a [plugin](https://stackoverflow.com/questions/25065580/log4j2-custom-plugins-annotation-processing-with-maven-assembly-plugin) for handling the issue, however there's no way to do that via Leiningen at the moment.
Include the dependency in the project, log4j will pick it and allow using `.edn` files for configuraiton.
The logging configruation must be present under the `:logger` key in the EDN file, e.g:
```clojure
{:logger
{:configuration
{:name "DefaultConfig"
:ThresholdFilter {:level "debug"}
:appenders
{:appender
[{:type "Console"
:name "Console"
:target "SYSTEM_OUT"
:PatternLayout {:pattern "[%d][%p][%c] %m%n"}}
{:type "RollingFile"
:name "File"
:fileName "./log/myapp.log"
:filePattern "./log/myapp-%d{MM-dd-yyyy}-%i.log.gz"
:PatternLayout {:pattern "[%d][%p][%c] %m%n"}
:DefaultRolloverStrategy {:max "10"}
:Policies
{:SizeBasedTriggeringPolicy {:size "10 MB"}}}]}
:loggers {:logger
[{:name "org.xnio.nio"
:level "warn"}]
:root {:level "info"
:AppenderRef
[{:ref "Console"}
{:ref "File"}]}}}}}
```
The EDN under the `:logger` key is converted to JSON and follows log4j JSON configuration format.
See the official log4j documentation on [configuring JSON logging](https://logging.apache.org/log4j/2.x/manual/configuration.html#JSON) for details.
## License
Copyright © 2016 Dmitri Sotnikov
Distributed under the Apache License 2.0