https://github.com/plandes/clj-append
Log4j2 Logger that appends using print and println.
https://github.com/plandes/clj-append
clojure log4j repl
Last synced: 8 months ago
JSON representation
Log4j2 Logger that appends using print and println.
- Host: GitHub
- URL: https://github.com/plandes/clj-append
- Owner: plandes
- License: lgpl-3.0
- Created: 2016-06-29T20:49:20.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-03-08T20:58:28.000Z (over 1 year ago)
- Last Synced: 2025-01-02T04:14:38.577Z (9 months ago)
- Topics: clojure, log4j, repl
- Language: Java
- Size: 369 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Log4j2 Logger that appends using print and println.
===================================================Adding this package to your project enables
[Log4j2](http://logging.apache.org/log4j/2.x/) to log to the
[Cider](https://github.com/clojure-emacs/cider) REPL.As of 6/22/2019 it appears newer versions of the Emacs Cider REPL no longer
need this.Obtaining
---------
See [dependencies](https://plandes.github.io/clj-append/dependency-info.html)Using
-----
# Configuration
Create a log4j2.xml in your `resources` or `test-resources` directory
specifying the appender in the configuration element:
```xml
```
This project includes slf4j and could conflict with other dependencies, in
which case you'll want to exclude them (see below). You also won't need this
package outside the REPL, in which case you could add it as a `dev` profile.
In your `project.clj`:
```clojure
(defproject example/project "0.1.0-SNAPSHOT"
:exclusions [org.slf4j/slf4j-log4j12
ch.qos.logback/logback-classic]
:profiles {:dev {:dependencies
[com.zensols/clj-append "1.1.0"]}})
```# REPL
Each time you invoke the REPL you need to give the logger the REPL's `*out*` reference:
```clojure
user> (com.zensols.clojure.log.ClojureAppender/setWriter *out*)
```This is a drag, so you could put this in your `~/.emacs.d/init.el` file:
```lisp
(defun clj-append-clojure-connected ()
(let ((buf (first
(remove* nil (buffer-list)
:test-not #'(lambda (a b)
(string-match "^\*cider-repl" (buffer-name b)))))))
(save-excursion
(set-buffer buf)
(goto-char (point-max))
(insert "(com.zensol.clojures.log.ClojureAppender/setWriter *out*)")
(cider-repl-return))))(add-hook 'cider-connected-hook 'clj-append-clojure-connected)
```Documentation
-------------
More [documentation](https://plandes.github.io/clj-append/):
* [Javadoc](https://plandes.github.io/clj-append/apidocs/index.html)
* [Dependencies](https://plandes.github.io/clj-append/dependencies.html)License
-------
Copyright © 2016 Paul LandesGNU Lesser General Public License, Version 3.0