【问题标题】:Access log pattern for Response time Undertow system- Wildfly 14.0.1响应时间 Undertow 系统的访问日志模式 - Wildfly 14.0.1
【发布时间】:2019-04-05 11:45:28
【问题描述】:

在 undertow 子系统上记录对请求的总响应时间的访问日志模式是什么?

<subsystem xmlns="urn:jboss:domain:undertow:7.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other">
            <buffer-cache name="default"/>
            <server name="default-server">
                <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
                <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
                <host name="default-host" alias="localhost">
                <access-log  prefix="access" pattern="%h %t %U%q %m %s %b %T"/>   <!-- use-server-log="true" -->
                    <location name="/" handler="welcome-content"/>
                    <http-invoker security-realm="ApplicationRealm"/>
                </host>
            </server>
            <servlet-container name="default">
                <jsp-config/>
                <websockets/>
            </servlet-container>
            <handlers>
                <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
            </handlers>
        </subsystem>

%T 在日志中只记录了一个“-”。请帮忙。

【问题讨论】:

    标签: wildfly undertow


    【解决方案1】:

    Here我发现了以下提示:

    处理请求所花费的时间,以秒为单位。除非 record-request-start-time 设置为 true,否则它将不起作用,请参见上面的 %D。

    还有一个如何配置它的链接。 record-request-start-time

    【讨论】:

    • 非常感谢。似乎工作。时间单位是什么?可以配置为毫秒吗?
    • 使用 %D 代替 %T
    • 非常感谢。但是有没有办法记录请求者的实际远程 IP?谁可能在代理背后?
    • 好吧...尝试阅读整个page 或至少使用搜索。我没有测试它,但我相信它是%a。关于代理我不知道。也许你可以创建一个新问题
    • 我正在寻找 %v - 本地服务器名称,但没有打印端口号,有什么方法可以实现吗?使用undertow log模式?
    【解决方案2】:

    如果你从 Spring Boot 开始,属性是

    server.undertow.options.server.record-request-start-time=true
    server.undertow.accesslog.pattern=[...] %T
    

    【讨论】:

      猜你喜欢
      • 2021-05-28
      • 1970-01-01
      • 2020-02-18
      • 2016-06-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-18
      • 1970-01-01
      相关资源
      最近更新 更多