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

Add support for Log4j2 #50

Closed
sdeleuze opened this issue Sep 11, 2022 · 6 comments
Closed

Add support for Log4j2 #50

sdeleuze opened this issue Sep 11, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@sdeleuze
Copy link
Collaborator

sdeleuze commented Sep 11, 2022

I currently see a java.lang.NoSuchMethodException: org.apache.logging.log4j.message.DefaultFlowMessageFactory.<init>() error in Spring smoke tests log4j2-native-tests.zip sample.

@sdeleuze sdeleuze added the enhancement New feature or request label Sep 11, 2022
@sdeleuze
Copy link
Collaborator Author

I tried to provide support for this but have found a blocking issue, so I think native support for Log4j2 needs to happen directly on library side rather than here, see related comment on their bugtracker.

@sdeleuze
Copy link
Collaborator Author

Given the fact that Log4j2 needs to happen at least partially via builtin support, I think that's better to close this issue at least for now. Upcoming discussion should happen on https://issues.apache.org/jira/browse/LOG4J2-2649.

@darxriggs
Copy link

It might be useful to update the link to the "logging-log4j2" sample in the issue description to a version of the repository that still contains this sample (now that it has been removed).

@sdeleuze
Copy link
Collaborator Author

sdeleuze commented Nov 6, 2022

I have linked the sample attached to the Log4j2 issue.

@Periecle
Copy link

Periecle commented Apr 7, 2023

@sdeleuze I believe I have found a way to do that without changing anything into Log4j2. They need LambdaMetafactory thing to work around the Security Context switching issue. However, as Graal Native Image does not have a security manager - we do not need it, so I just replaced that class and excluded that part of the code via SVM Target/Substitute functionality. I verified my idea and provided a simple PoC for that. I have generated a basic reflect-config and manually edited it to support as many features as I could, but that is not a production-ready solution, and still, it works.

Here is my PoC. I am not sure we can merge such a thing in that repo(because of NativeServiceLoaderUtil).
https://github.com/Periecle/log4j2-native-tests

@CheneyWong
Copy link

--enable-url-protocols=http

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

No branches or pull requests

4 participants