Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vedang/clj-logging
This is a template Clojure project showcasing how to configure Log4J2 as the logging backend properly, across all transitive dependencies of the project.
https://github.com/vedang/clj-logging
clojure logging
Last synced: 2 months ago
JSON representation
This is a template Clojure project showcasing how to configure Log4J2 as the logging backend properly, across all transitive dependencies of the project.
- Host: GitHub
- URL: https://github.com/vedang/clj-logging
- Owner: vedang
- License: epl-1.0
- Created: 2021-12-13T18:32:55.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-28T08:39:38.000Z (9 months ago)
- Last Synced: 2024-10-04T19:24:51.465Z (3 months ago)
- Topics: clojure, logging
- Language: Clojure
- Homepage:
- Size: 31.3 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# me.vedang/logger : Emitting Structured Logs from your Clojure code
This is a `deps-new` template which creates a logger component that I use in my code. I reproduce this same logging code in every new project using this template
## Usage
To install this code, run the following command inside your project
$ clojure -Sdeps '{:deps {io.github.vedang/clj-logging {:git/sha "e009d366c827705f513ef9018ffd920a49ce19da"}}}' -Tnew create :template me.vedang/logger :name your.group.artifact/logger
Note: The command above assumes you have installed `deps-new` as your `new` "tool" via:
```bash
clojure -Ttools install-latest :lib io.github.seancorfield/deps-new :as new
```This is create a folder called `logger`. To use this folder, you can add an alias as follows to your main `deps.edn` file:
```clojure
:logs-dev
{:extra-deps {me.vedang/logger {:local/root "logger"}}
:jvm-opts
["-Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory"
"-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog"
"-Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector"
"-Dlog4j2.configurationFile=logger/log4j2-dev.xml"
;; Change logging.level to one of TRACE, DEBUG, INFO, WARN, ERROR
;; depending on requirement during development
"-Dlogging.level=DEBUG"]}
```## Developing the template
Run this template project's tests (by default, this just validates your template's `template.edn`
file -- that it is valid EDN and it satisfies the `deps-new` Spec for template files):$ clojure -T:build test
## License
Copyright © 2024 Vedang Manerikar
Distributed under the Eclipse Public License version 1.0.