Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] Content Length in Request Log(NCSARequestLog)


Jhony,

I have completely reworked the RequestLog mechanism in Jetty-9.3.    I have gone away from the approach of trying to log either from a handler finally block or from an async listener.  Instead, logging is now directly supported by the commit and flush mechanisms of the HttpChannel, thus it does not care how the content/response was generated and will be able to log the status and written content length.   The log handler is still present, but only needed if you wish to have multiple request logs and it simply sets the log that the HttpChannel uses.

These changes will be included in the next 9.3.M release.  These releases are moderately stable and only really waiting on the HTTP/2 RFC to become stable.

cheers






On 19 November 2014 11:58, Jhony Jhony <oohjhony@xxxxxxxxx> wrote:
Thanks Joakim for your reply.

I agree with your point, but with other web servers like Glassfish, Tomcat etc.when the access log is enabled they do log the content length even when the content length header is missing in web app response.

Is there is any workaround available?

--Jhony




On Tue, Nov 18, 2014 at 11:50 AM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
Seeing as the logging on RequestLog occurs once the response is committed (in other words when response headers are sent), then the content-length in your scenario would likely be unset.

If you were to use a streaming response, with chunked encoding, or respond with partial content ranges, etc... then the Content Length would also be not be what you hope it would be.
Also, what would we log if the response contained a content-length value, but the response was terminated before the entire response content was finished being sent?

The logging of content length is what the response headers itself stated, not what was actually sent.


--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts

On Mon, Nov 17, 2014 at 11:29 AM, Jhony Jhony <oohjhony@xxxxxxxxx> wrote:
Hello Developers,

In my code to enable the access log I have added NCSARequestLog handler, which generates the request log with all the necessary information.

With respect to content length header I am getting this only if the web application set this header in part of their response.  If the web application does not set the content length header then it is missing in the request log.

Do I need to add some extra code to enable this or I am missing something else.

Thanks in advance for looking into this.

Yours,
Jhony

_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-dev


_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-dev


_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-dev


Back to the top