- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3k
Make access logging work in native mode #9474
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
Conversation
| if (serviceInterfaceClassName == null || serviceInterfaceClassName.trim().isEmpty()) { | ||
| throw new IllegalArgumentException("service interface name cannot be null or blank"); | ||
| } | ||
| final ClassLoader classLoaderToUse = cl == null ? Thread.currentThread().getContextClassLoader() : cl; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An issue with this approach is that if there are additional service implementations on the deployment class path that are not on the runtime class path this will cause failures. Not sure how likely this in practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. I hadn't thought of this scenario. I think I might have a slightly different way to achieve this same functionality without having to run into the issue that you note here. I'll try it out and update the PR shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I don't think the ClassLoader issue will actually be a problem in practice.
        
          
                ...vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxHttpProcessor.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
      …ttributeBuilder service providers for access logging to work in native image
| Hello @stuartwdouglas, given that the goal of this change was to register the "core"  | 
| Thanks Jaikiran | 
| thx guys for working on this issue | 
Fixes #9047
Right now, access logging isn't working in native mode as reported in the issue. This is because the
ExchangeAttributeBuilder(s) which are responsible for handling the access log format specifier areServiceLoaderbased interfaces and as such need to be explicitly registered in native image for them to be available.The commit here explicitly makes them available in native mode and also includes a test to reproduce the issue and verify the fix.