Jetty9.x添加日志

 

参考:

Jetty 9.2请求访问日志配置

https://blog.csdn.net/w_j_w2010/article/details/47973779 

有效可用:
 

找开jetty.home/etc/jetty.xml文件, 添加如下内容。

1)  添加请求处理LandlerRequestLogHandler

    <Item>

      <New id="RequestLog"class="org.eclipse.jetty.server.handler.RequestLogHandler"/>

    </Item>
 

 2)添加创建请求处理实例配置


  <Ref id="RequestLog">
    <Set name="RequestLog">
    <New id="RequestLog" class="org.eclipse.jetty.server.AsyncNCSARequestLog">
      <Set name="filename"><Property name="jetty.logs" default="./logs" />/access.yyyy_mm_dd.log</Set>
      <Set name="filenameDateFormat"><Property name="jetty.requestlog.filenameDateFormat" deprecated="requestlog.filenameDateFormat" default="yyyy_MM_dd"/></Set>
      <Set name="retainDays"><Property name="jetty.requestlog.retainDays" deprecated="requestlog.retain" default="90"/></Set>
      <Set name="append"><Property name="jetty.requestlog.append" deprecated="requestlog.append" default="false"/></Set>
      <Set name="extended"><Property name="jetty.requestlog.extended"    deprecated="requestlog.extended" default="false"/></Set>
      <Set name="logCookies"><Property name="jetty.requestlog.cookies"   deprecated="requestlog.cookies" default="false"/></Set>
      <Set name="LogTimeZone"><Property name="jetty.requestlog.timezone" deprecated="requestlog.timezone" default="GMT"/></Set>
   </New>
  </Set>
</Ref>

  

线上jetty环境如何配置request log(第二种方法)

https://blog.csdn.net/zx_emily/article/details/79975389

 

 

如何更改Jetty请求日志*文件名*的时区?

 https://www.thinbug.com/q/21421081

 

有效可用:

<Ref id="Handlers">
  <Call name="addHandler">
    <Arg>
      <New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler">
        <Set name="requestLog">
          <New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
            <Set name="filename">
               logs/request.yyyy_mm_dd.log
            </Set>
            <Set name="filenameDateFormat">yyyy_mm_dd</Set>
            <Set name="retainDays">365</Set>
            <Set name="append">true</Set>
            <Set name="extended">false</Set>
            <Set name="logCookies">false</Set>
            <Set name="LogTimeZone">GMT-5</Set>
          </New>
        </Set>
      </New>
    </Arg>
  </Call>
</Ref>

 

posted @ 2021-10-20 16:02  kelelipeng  阅读(616)  评论(0编辑  收藏  举报