Closed dVenkatNaveen closed 1 month ago
Replaced with org.eclipse.jetty.server.Handler.Sequence
https://javadoc.jetty.org/jetty-12/org/eclipse/jetty/server/Handler.Sequence.html
Thanks @joakime i am using the below bean creation in jetty 11 and migrating now with 12.
<bean id="example2" class="org.eclipse.jetty.server.handler.RequestLogHandler">
<property name="requestLog">
<bean class="org.eclipse.jetty.server.CustomRequestLog">
<constructor-arg>
<bean class="org.eclipse.jetty.server.RequestLogWriter">
<property name="filename" value="#{logsDir}/jetty.log" />
<property name="retainDays" value="${retainDays:7}" />
<property name="append" value="true" /> <!-- Append logs to the existing log file on restart -->
<property name="timeZone" value="GMT" /> <!-- Set time zone for log timestamps -->
<property name="filenameDateFormat" value="yyyy_MM_dd" /> <!-- Log file date format -->
</bean>
</constructor-arg>
<constructor-arg value="%{Referer}i" "%{User-Agent}i" "%{Cookie}i"" />
<!-- Custom NCSA log format -->
</bean>
</property>
</bean>
with jetty 12 i dont see org.eclipse.jetty.server.handler.RequestLogHandler any alternate for this and when i pass with only customrequestlog to sequence it expects required type to Handler.
Cannot convert value of type 'org.eclipse.jetty.server.CustomRequestLog' to required type 'org.eclipse.jetty.server.Handler' for property 'logHandler': no matching editors or conversion strategy found
@dVenkatNaveen normally the RequestLog
is added directly to the server with Server#setRequestLog
.
There is also a Jetty module you can add in standalone Jetty that you can add to avoid having to write any XML to do this. https://jetty.org/docs/jetty/12/operations-guide/modules/standard.html#requestlog
But it looks like the RequestLogHandler
has been removed without a replacement in Jetty 12.
@joakime do you think this is something we should re-implement for Jetty 12?
Thanks for the update @lachlan-roberts. Let me try with RequestLog.
@lachlan-roberts can you also help the below alternate classes in jetty 12 porting from jetty 11. import org.eclipse.jetty.webapp.ClassMatcher ----> ? import org.eclipse.jetty.webapp.WebAppContext ----> ? import org.eclipse.jetty.deploy.providers.WebAppProvider --> import org.eclipse.jetty.deploy.providers.ScanningAppProvider?
@joakime do you think this is something we should re-implement for Jetty 12?
No, we should not reimplement RequestLogHandler
in Jetty 12.
That encourages the bad behaviors of RequestLog
that were the source of bugs in Jetty versions prior to Jetty 12.
We don't want to go back to the place where some HTTP exchanges were not logged, simply because it was a Handler (and sometimes a Handler in the wrong place in the handler chain).
@lachlan-roberts can you also help the below alternate classes in jetty 12 porting from jetty 11. import org.eclipse.jetty.webapp.ClassMatcher ----> ?
See the API on WebAppContext, once you have selected the WebAppContext for the environment appropriate for you. WebAppContext.addHiddenClassMatcher(ClassMatcher) WebAppContext.addProtectedClassMatcher(ClassMatcher) See link below for how to select the environment most appropriate for you.
import org.eclipse.jetty.webapp.WebAppContext ----> ?
These are environment specific, there are multiple versions of this present. See https://jetty.org/docs/jetty/12/programming-guide/migration/11-to-12.html to pick the one appropriate for you.
import org.eclipse.jetty.deploy.providers.WebAppProvider --> import org.eclipse.jetty.deploy.providers.ScanningAppProvider?
This is also environment specific. See above link for details on how to pick the environment appropriate for you.
Also, see the example for deploying ... https://github.com/jetty/jetty-examples/tree/12.0.x/embedded/deploying
I have updated the documentation in #12391
**Jetty
Version**using jetty 12.0.14
Jetty Environment
trying to migrate from jetty 11.x to 12.x
Java Version using java 17 Question previously creating the bean with HandlerCollection which contains list of handlers but with jetty 12.x what is alternate class for HandlerCollection or how does i create now?