[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-dev] Implementing org.eclipse.jetty.server.RequestLog in logback-access for Jetty 12
|
Hi All,
Thank you all for your replies. They were *all* very helpful.
The logback-access project is moving to a new repository, from logback
[1] to logback-access [2].
The preexisting logback-access mopdule been recently restructured to
provide access loggers for Tomcat and Jetty as *separate* modules based
on the "common" module See [3].
Access logging support for Tomcat 10, Tomcat 11 and Jetty 11 are all
small variations on a processing pipeline around the IAccessEvent
interface [4] and its notable implementation AccessEvent. AccessEvent
relies heavily on jakarta.servlet.http.HttpServletRequest and
HttpServletResponse.
In order to support Jetty 12 and still leverage the common module, it
was decided to create RequestWrapper, a wrapper around
o.e.jetty.server.Request which implements
jakarta.servlet.http.HttpServletRequest [5]. There is also a wrapper
around o.e.jetty.server.Response.
More testing is needed but for the time being, this wrapper solution
seems to work with Jetty 12.
Best,
--
Ceki Gülcü
Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch
[1] https://github.com/qos-ch/logback/
[2] https://github.com/qos-ch/logback-access/
[3] https://github.com/qos-ch/logback-access/blob/main/common/pom.xml
[4]
https://github.com/qos-ch/logback-access/blob/main/common/src/main/java/ch/qos/logback/access/common/spi/IAccessEvent.java
[5]
https://github.com/qos-ch/logback-access/blob/main/jetty12/src/main/java/ch/qos/logback/access/jetty/RequestWrapper.java
On 1/22/2024 11:22 PM, Greg Wilkins via jetty-dev wrote:
> All,
>
> Note that even for our own logging, there are some servlet specific
> parameters that we set as a request attribute so they can be logged from
> a core request.
>
> I've never really liked this and would be keen to think of something
> more elegant.
>
> So if logback also has some servlet specific stuff that needs to be
> logged, it can use the existing mechanism... But let's have a thought
> first to see if it can be improved.
>
> Ceki, what servlet specific stuff do you need from a request (if any).
>
>
> On Tue, 23 Jan 2024, 01:53 Joakim Erdfelt via jetty-dev,
> <jetty-dev@xxxxxxxxxxx <mailto:jetty-dev@xxxxxxxxxxx>> wrote:
>
> Jetty 12 has no dependency on the servlet spec anymore.
>
> The servlet classes only exist for specific environments.
>
> "ee8" - based on Servlet 4, has javax.servlet.
> "ee9" - based on Servlet 5, has jakarta.servlet
> "ee10" - based on Servlet 6, has jakarta.servlet
>
> The RequestLog mechanism for Jetty 12 is based on "core" which has
> no Servlet dependency.
> It is entirely possible (and growing quite popular) to run a server
> on Jetty 12 without using the Servlet layer.
>
> Like Simone pointed out, you want logback-access to implement the
> core org.eclipse.jetty.server.RequestLog
> And document that it should be added to the Server via a call to
> Server.setRequestLog(new LogbackAccessRequestLog())
> For standalone users you can provide a jetty-start module that
> downloads the required jars and associated XML from maven central
> (or any arbitrary URL) and then makes it available correctly to
> their jetty.base instance.
>
> Joakim Erdfelt / joakim@xxxxxxxxxxx <mailto:joakim@xxxxxxxxxxx>
>
>
> On Mon, Jan 22, 2024 at 3:31 AM Ceki Gulcu via jetty-dev
> <jetty-dev@xxxxxxxxxxx <mailto:jetty-dev@xxxxxxxxxxx>> wrote:
>
>
> Hello All,
>
> In the context of the logback-access project, I am trying to
> implement
> the RequestLog interface for Jetty 12.
>
>
> The logback-access project has implementations of the RequestLog
> interface for earlier versions of Jetty, e.g. versions 9, 10, 11.
> In these earlier versions of Jetty, the
> org.eclipse.jetty.server.Request
> class was also an implementation of
> jakarta.servlet.http.HttpServletRequest interface.
>
> In Jetty versions 12 however, and as far as I understand, this is no
> longer the case.
>
> Given org.eclipse.jetty.server.Request or o.e.j.s.Response, how
> can I
> obtain the corresponding jakarta.servlet.http.HttpServletRequest or
> HttpServletResponse in Jetty 12?
>
> Many thanks for your assistance.
>
> --
> Ceki Gülcü
>
> Sponsoring SLF4J/logback/reload4j at
> https://github.com/sponsors/qos-ch
> <https://github.com/sponsors/qos-ch>
> _______________________________________________
> jetty-dev mailing list
> jetty-dev@xxxxxxxxxxx <mailto:jetty-dev@xxxxxxxxxxx>
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-dev
> <https://www.eclipse.org/mailman/listinfo/jetty-dev>
>
> _______________________________________________
> jetty-dev mailing list
> jetty-dev@xxxxxxxxxxx <mailto:jetty-dev@xxxxxxxxxxx>
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-dev
> <https://www.eclipse.org/mailman/listinfo/jetty-dev>
>
>
> _______________________________________________
> jetty-dev mailing list
> jetty-dev@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-dev