Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log4j2 compatibility #2

Open
vemv opened this issue Jun 19, 2023 · 1 comment
Open

Log4j2 compatibility #2

vemv opened this issue Jun 19, 2023 · 1 comment

Comments

@vemv
Copy link
Member

vemv commented Jun 19, 2023

Context

clojure-emacs/cider-nrepl#773 (comment)

Brief

Right now this works with Logback (which I am using) and Java Util Logging. There is some code for Log4j2 that passes some of the tests, but I couldn't make it working reliably. The issue seems that Log4j2 reloads its configuration when a new appender is added, and wipes out the changes. I tried most of the suggestions on Stackoverflow to get it working, but I'm giving up on this one. I already spent too much time on this. So, I propose to drop that code into a branch of the separated library. If anyone knows how to get it working, I'm willing to help, but I won't investigate this beast any further.

Possible solutions

  • Persevere through the original approach
  • Try a less dynamic approach:

Would it help if the nrepl logger wasn't dynamically added?
e.g. one could configure it such that it's instantiated as the JVM starts.
This would probably involve a .xml file or a user.clj file.
...this would not invalidate the current, dynamic approach, I'd see it instead of an additional, opt-in manner to run things.

It might, but I believe for this to work we would need to use gen-class to create an appender class that implements some Log4j2 interface and ship it, so that it can be referenced in the configuration file.
And then somehow connect this with the atom to which events are added.

@r0man
Copy link
Collaborator

r0man commented Jun 22, 2023

I did some experiments with Log4j2 which I pushed into this branch: https://github.com/clojure-emacs/logjam/tree/log4j2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants