zoukankan      html  css  js  c++  java
  • SpringBoot项目 配置tomcat access_log日志

    在配置文件application.yml里面来配置tomcat accesslog日志:

    server:
      port: 80
      tomcat:
        accesslog:
          enabled: true
          directory: D:\Documents\D_代码相关\J_java\sprintboot_study
          prefix: tomcat_access_log
          suffix: .log
          file-date-format: -yyyy-MM-dd
          pattern: '%{X-Real-IP}i - %{Host}i %t "%r" %{Content-Length}i %s %b %D "%{Referer}i" "%{User-Agent}i" %a "%I" "-"'
          rotate: true

    日志记录格式(pattern),形式参照 :

    nginx 日志 log_format:

    log_format main '$http_x_real_ip - $http_host [$time_local] "$request" $request_length '
                                 '$status $body_bytes_sent $request_time "$http_referer" '
                                 '"$http_user_agent" $remote_addr "-" "-" ';

    tomcat access log pattern:

    pattern: '%{X-Real-IP}i - %{Host}i %t "%r" %{Content-Length}i'
                  '%s %b %D "%{Referer}i"'
                 '"%{User-Agent}i" %a "%I" "-"'

    %{X-Real-IP}i: http X-Real_IP
    %{Host}i: http Host
    %t: Date and time, in Common Log Format
    %r: First line of the request (method and request URI)
    %{Content-Length}i: request length
    %s: HTTP status code of the response
    %b: Bytes sent, excluding HTTP headers, or ‘-’ if zero
    %D: Time taken to process the request, in millis
    %{Referer}i: http Referer
    %{User-Agent}i: http User-Agent
    %a: Remote IP address
    %I: Current request thread name (can compare later with stacktraces)

  • 相关阅读:
    夜空中最亮的星
    让我留在你身边
    反思
    又想起民谣那诗
    初学积性函数
    P1049 装箱问题(01背包)
    set
    紫书 习题 10-4 UVa 1644(素数筛)
    紫书 习题 10-2 UVa 808(建立坐标+找规律)
    紫书 习题 10-1UVa 111040(找规律)
  • 原文地址:https://www.cnblogs.com/yyxianren/p/15735269.html
Copyright © 2011-2022 走看看