-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add support for NCSA Extended Log File Format #113
Comments
As far as I can see, the Response object is passed to the RequestLog interface: It's just not passed to abstract logExtended() method here: |
@joakime We are passing a Jetty Request, not a Servlet Request, so the getResponse() method is available. So access is not a problem... I'd be more concerned about what values exist and are valid at the time the log is generated. |
Issue #342 re-introduced the Response object. @bushwakko to understand what @gregw said, you can do this ... @Override
protected void logExtended(Request request, StringBuilder b) throws IOException
{
Response response = request.getResponse();
b.append("content-type=").append(response.getContentType());
} |
It would also be good to support %X style info (aborted, persisted, closed) logging |
I think it would be good to have a CustomRequestLog that used a format string to format the log lines. I think this can probably be done efficiently with methodHandles, but my handle-foo is not totally up to speed yet. So I have asked https://stackoverflow.com/questions/52962364/how-to-chain-methodhandle-invocations to find out a good way to do this. If I get a satisfactory answer, then I'll give it a go. |
Fixed javadoc removed BadRequestLogHandlerTest (tested in RequestLogTest) added JMH to show the future of request logging for #113
I have experimented with MethodHandles as a mechanism for a flexible requestLog and the results are good. The JMH test is committed here c086608#diff-e863396909916b7e9fd3c8cc56e47dff and produced the following results:
So methodHandles are just as fast as dedicated format code, but produce a little less garbage! @sbordet @joakim can you see anything I can improve with the MethodHandle usage? |
@lachlan-roberts Can you work on this issue? We need to create a new class called CustomRequestLog that will take format strings roughly based on http://httpd.apache.org/docs/current/mod/mod_log_config.html. An early task will be to look at that table and see what matches to things we already have logging for, what we can add and what is not really compatible - we should document our own table before writing any code. Then look at the JMH test above to see the technique that I'm suggesting we use... and come up with a way to turn a format string into such a methodHandle. Should be fun! |
Issue #3018 improve logging and handling of slow data rates. * Slow data rates now result in aborted channels, but exception is still thrown. Test for 408 in requestLog * Updated many RequestLog usages to use Server.setRequestLog rather than a RequestLogHandler * Fixed javadoc * removed BadRequestLogHandlerTest (tested in RequestLogTest) * added JMH to show the future of request logging for #113 * copyright header. * Updates from review * Revert to throwing BadMessageException * BME ensures a 408 is logged rather than a 500 Signed-off-by: Greg Wilkins <gregw@webtide.com>
created new CustomRequestLog class Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
javadoc detailing the custom log formats Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
update logHandle directly rather than creating list of tokens Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Introduced the RequestLog.Writer where a RequestLog takes a writer which manages what to do with the log strings produced by the RequestLog deprecated the NCSA and SLF4J RequestLogs in favor of CustomRequestLog Implemented more format codes in CustomRequestLog Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
…ring renamed to NcsaRequestLogTest as is only testing NCSA log formats Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
…cleanups Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
added missing copyright header in some new files added CustomRequestLogTest in jetty-servlet to test things like logFilename and logRequestHandler the log strings produced do no longer contain a trailing newline implemented more tests in CustomRequestLogTest and finished implementing some of the logging in CustomRequestLog Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
replaced terminology for addresses and ports to use client and server referring to the logical connection and local and remote referring to the physical connection to the first hop finished implementing tests in CustomRequestLogTest otherwise disabled tests which will be verified manually instead Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
removed tests for %B and %b which have been removed in favor of %O adjusted the NcsaRequestLogTest to only test ExtendedNCSA format Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
%t now takes in locale and timezone in the format string argument instead of getting it from the setters on the CustomRequestLog class fixed issue with multiline format strings requestLog writers are now managed objects Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
…ceptions Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Issue #113 CustomRequestLog as default in jetty-10
migrated from Bugzilla #404328
status ASSIGNED severity minor in component server for 9.3.x
Reported in version 9.0.0 on platform All
Assigned to: Project Inbox
On 2013-03-26 02:01:20 -0400, Greg Wilkins wrote:
On 2013-05-21 20:17:04 -0400, Joakim Erdfelt wrote:
On 2014-09-22 18:12:57 -0400, Joakim Erdfelt wrote:
On 2015-04-22 20:31:41 -0400, Greg Wilkins wrote:
The text was updated successfully, but these errors were encountered: