-
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
Logs are not recorded using CustomRequestLog #12595
Comments
The This should be done at startup of the Server. Just enable the |
I have multiple webapps running in a server and i want to seperate the requestlogs based on the WebAppContext, how can i achieve this using |
Hi @joakime any suggestions on the above comment. |
@HemanthKarniyana you cannot do that with RequestLog. The RequestLog only exists on the Server level. (your own XML shows this) This is because RequestLog needs to report all request access types, even failures. |
Thank you for the response. |
@HemanthKarniyana note, there are some solutions to RequestLog that others have been happy with. One scenario is to use Slf4jRequestLogWriter instead of RequestLogWriter. https://javadoc.jetty.org/jetty-12/org/eclipse/jetty/server/Slf4jRequestLogWriter.html This makes all of the RequestLog events output on slf4j, to the named logger of your choice. With this setup, you can use the combination of NDC/MDC with Logging event sifting/appending. And you would setup your logging library to sift based on that NDC/MDC context to individual files. The end result is that requests that reach the webapp properly get sifted into their own logging files, but other failed requests sit in the default logging file. |
Hello @joakime , i have tried the above mentioned approach. But the problem is " whenever a http request is made, the server checks for MDC.get(contextPath) before entering into the filterchain itself. the contextPath is null and always logs to default file. Below are the details, can you please help if am missing something.
Please have a look whenever you got some time. Thank you. |
Jetty Version
12.0.14
Jetty Environment
ee8
Java Version
17
Question
Am trying to record the http request logs into a file using RequestLogWriter and CustomRequestLog as follows :
With the below setup, the file is getting created /tmp/example-2024_11_27.request.log but the logs are not getting recorded, any suggestion would be great help. Thank you.
The text was updated successfully, but these errors were encountered: