-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Display HTTP request contents in the log in a long format #8656
Comments
Hello @gastaldi. Could you please show me the way? This would be my first contribution to the project. |
@hbelmiro I think a Filter would do the job |
Does it need to be specific implementations for each extension or can we create a common filter that will be used by all of them? I prefer the second option, but I don't know if it is possible. |
Since Undertow uses Vert.x, I think a Vert.x filter should be enough. |
@gastaldi I created these three classes: It's logging like following:
Is that what you're wondering or I can log something else? Besides that, I have another few questions:
|
@hbelmiro that looks nice. TBH I was expecting an output similar to the HTTP request:
Yes, a property in application.properties is a good solution IMHO
I think it should happen before AUTHENTICATION. |
@gastaldi I changed the format to:
I couldn't find a way to inject this HttpRequestFormatter in HttpLoggingHandler class. I tried in several ways, but none of them worked. Do you know what is the right way to inject a dependency in my Handler? |
@hbelmiro I think Vert.x already has a feature to log requests. Look for |
@gastaldi It works with io.vertx.ext.web.handler.LoggerHandler. DEFAULT SHORT TINY We could allow the user to choose a format by application.properties, or else the "DEFAULT" format would be used. |
+1, I think we could even propose a |
@hbelmiro hey, thanks for the hard work! As @stuartwdouglas pointed out in this feature is already implemented, it just doesn't display the long format as you have implemented. Would you mind changing your PR (or opening a new one) with that dump feature implemented? Sorry about the noise, totally my fault. I should have seen that #5556 was already implemented. |
BTW I have updated the issue description |
@gastaldi No problem. These things happen. |
@gastaldi Today there are two formats that can be used: "common" and "combined".
So we need to create the new format using the attributes defined in this table But there isn't an attribute for all headers. The existing attribute is for a specific header: %{i,request_header_name}. If we decide to create a new one, we'll also have to create a way to format them, since those attributes are used for other things too. In our case, for example, we want to print this way:
But there might be cases where the user needs to print them like this, for example:
Would you like to discuss this with someone else before we decide anything? |
I would add %{ALL_HEADERS} that dumps it in the one per line format. If there is a request for the single line format we can look at it later. |
What about %{ALL_REQUEST_HEADERS}? Or should %{ALL_HEADERS} dump the response ones too? |
All request headers is probably best.
…On Fri, 10 Jul 2020, 11:54 pm Helber Belmiro, ***@***.***> wrote:
What about %{ALL_REQUEST_HEADERS}? Or should %{ALL_HEADERS} dump the
response ones too?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8656 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACQG64M274PZY4RHLQ7OB3R24MPHANCNFSM4MK3KHEQ>
.
|
New PR created (10654). |
@gastaldi I updated the PR. I couldn't find a way to display the request body because it isn't available when the attributes are read. |
It would be nice if we could enable a log of the request that comes to Quarkus and check the headers, method, path of the request, something like a verbose mode of curl.
UPDATE
Access log is already implemented in #5556 / 7b9c133 and was released in 1.4.0.Final, so this issue is about displaying the HTTP contents in a long format, like:
As suggested by @stuartwdouglas, the idea is to add a 'dump' or 'full' option to the config and an attribute that prints all the headers and have the 'dump' format string print the request line followed by the headers
The text was updated successfully, but these errors were encountered: