-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Make logback access logging work with Jetty 12 #719
Comments
Hi @mvestola. Supporting this without inconvenience for users won't be possible for logback. As you've correctly mentioned, the Jetty To overcome this problem, the It would be inconvenient, if a user would have to register a custom handler to get the request log working, but it would also be incovenient, if logback would register the handler itself. For reference, see the modifications I've made to Dropwizard to get the |
Hi @mvestola we ran into the same problem at the company where I work and we found no workaround for this to get it working with Jetty 12/ Spring Boot 3.2. Ideally we would have preferred to get this implemented in the logback-access framework, but like already mentioned above here in this discussion the Jetty classes are completely different and we did not manage to find any good way to create a pull request to get this merged without breaking backwards compatibility with older versions of Jetty. |
Is there a timeline yet on when we think this might go in? Or is the plan that logback access will not be compatible with Jetty long term? |
@yachtintheband logback-access moved to its own repo. It already supports Jetty 12. |
Logback-access version 2.0.0 has been released. It supports Jetty versions 11 and 12. |
Jetty 12 has been released July 20, 2023 and it is the latest stable release of Jetty: https://projects.eclipse.org/projects/rt.jetty/releases/12.0 . There has been quite many changes in Jetty 12 compared to earlier versions. One of the biggest change is probably "The Servlet-Api has been removed from the internals of Jetty allowing for non-servlet-based application creation."
These changes in Jetty 12 seems to make logback access logging not to work at all when using Jetty 12. At least I don't get any errors or stacktraces in logs but it just silently does not work. I am assuming that the problem might be in the log method of logback's RequestLogImpl:
So in the log method parameters it takes
org.eclipse.jetty.server.Request
and passes that to the constructor ofAccessEvent
which assumes that the request should implementjakarta.servlet.http.HttpServletRequest
. This has worked just fine with Jetty 10 and 11. But the case in Jetty 12 is that due to the big change mentioned above,org.eclipse.jetty.server.Request
no longer implementsjakarta.servlet.http.HttpServletRequest
.In Jetty 10 and 11, Request class is defined as
public class Request implements HttpServletRequest
: https://github.com/jetty/jetty.project/blob/jetty-10.0.x/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java#L145In Jetty 12, Request class is defined as
public interface Request extends Attributes, Content.Source
: https://github.com/jetty/jetty.project/blob/jetty-12.0.x/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java#L122So my guess is that the access logging most likely silently breaks due to this problem and should somehow be able to change
org.eclipse.jetty.server.Request
->jakarta.servlet.http.HttpServletRequest
or makeAccessEvent
to acceptorg.eclipse.jetty.server.Request
or some other better solution. Same problem is of course with thejettyResponse
object.Also package structure has changed in Jetty 12 a bit: https://webtide.com/new-jetty-12-maven-coordinates/ but not sure if this package structure change has any impact on logback since logback does not seem to reference classes in
org.eclipse.jetty.eeX
packages but onlyorg.eclipse.jetty.server.*
.There is
org.eclipse.jetty.ee9.nested.Request
in Jetty 12 which implementsHttpServletRequest
but using that is probably not an option to use since it seems to be Jetty internal class and would then depend on theorg.eclipse.jetty.eeX
packages.There has been some plans that Jetty 10 and 11 will probably reach end of life in couple of years, possibly in 2025, so would be good time to start preparing logback to also work with Jetty 12.
The text was updated successfully, but these errors were encountered: