jetty access log

1.  new xml file : jetty-logging -access.xml

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">


<!-- =============================================================== -->
<!-- Configure stderr and stdout to a Jetty rollover log file        -->
<!-- this configuration file should be used in combination with      -->
<!-- other configuration files.  e.g.                                -->
<!--    java -jar start.jar etc/jetty-logging.xml                    -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">

<!-- Built-in Jetty AccessLog log -->
<Ref id="AccessLog">
  <Set name="requestLog">
    <New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
      <Set name="filename"><SystemProperty name="jetty.logs" default="./logs"/>/access.yyyy_mm_dd.log</Set>
      <Set name="filenameDateFormat">yyyy-MM-dd</Set>
      <Set name="retainDays">30</Set>
      <Set name="append">true</Set>
      <Set name="extended">false</Set>
      <Set name="logLatency">true</Set>
      <Set name="LogTimeZone">Asia/Shanghai</Set>
    </New>
  </Set>
</Ref>

</Configure>

 2.  modify file jetty.xml

<!-- =========================================================== -->
    <!-- Set handler Collection Structure                            --> 
    <!-- =========================================================== -->
    <Set name="handler">
      <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
        <Set name="handlers">
         <Array type="org.eclipse.jetty.server.Handler">
           <Item>
             <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
           </Item>
           <Item>
             <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
           </Item>
		   <Item>
             <New id="AccessLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
           </Item>
         </Array>
        </Set>
      </New>
    </Set>

 

3. add etc/jetty-logging -access.xml to start.ini

 

https://wiki.eclipse.org/Jetty/Howto/Configure_Request_Logs

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值