Skip to content
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

Open
HemanthKarniyana opened this issue Nov 27, 2024 · 3 comments
Open

Logs are not recorded using CustomRequestLog #12595

HemanthKarniyana opened this issue Nov 27, 2024 · 3 comments
Labels

Comments

@HemanthKarniyana
Copy link

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.

<Configure id="Example" class="org.eclipse.jetty.ee8.webapp.WebAppContext">
  <New id="RequestLogWriter" class="org.eclipse.jetty.server.RequestLogWriter">
      <Set name="filename">/tmp/example-yyyy_mm_dd.request.log</Set>
      <Set name="filenameDateFormat"><Property name="jetty.requestlog.filenameDateFormat" default="yyyy_MM_dd"/></Set>
  </New>

  <New id="RequestLogImpl" class="org.eclipse.jetty.server.CustomRequestLog">
      <Arg><Ref refid="RequestLogWriter"/></Arg>
      <Arg>
        <Property name="jetty.customrequestlog.formatString">
          <Default>%{client}a - %u %t \"%r\" %s %O \"%{Referer}i\" \"%{User-Agent}i\"</Default>
        </Property>
      </Arg>
  </New>

  <Call name="setServer">
    <Arg>
      <New id="Server" class="org.eclipse.jetty.server.Server">
          <Set name="RequestLog"><Ref refid="RequestLogImpl"/></Set>
      </New>
    </Arg>
  </Call>
</Configure>
@joakime
Copy link
Contributor

joakime commented Nov 27, 2024

The RequestLog doesn't belong in a WebAppContext configuration.
That's far too late.

This should be done at startup of the Server.

Just enable the requestlog module, and configure it in ${jetty.base}/start.d/requestlog.ini

@HemanthKarniyana
Copy link
Author

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 requestLog module.

@HemanthKarniyana
Copy link
Author

Hi @joakime any suggestions on the above comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants