Reactor Netty Access Logs

要启用 Reactor Netty 访问日志,请设置 -Dreactor.netty.http.server.accessLogEnabled=true

To enable Reactor Netty access logs, set -Dreactor.netty.http.server.accessLogEnabled=true.

它必须是 Java 系统属性,而不是 Spring Boot 属性。

It must be a Java System Property, not a Spring Boot property.

可以配置日志系统以拥有一个单独的访问日志文件。以下示例创建了一个 Logback 配置:

You can configure the logging system to have a separate access log file. The following example creates a Logback configuration:

logback.xml
    <appender name="accessLog" class="ch.qos.logback.core.FileAppender">
        <file>access_log.log</file>
        <encoder>
            <pattern>%msg%n</pattern>
        </encoder>
    </appender>
    <appender name="async" class="ch.qos.logback.classic.AsyncAppender">
        <appender-ref ref="accessLog" />
    </appender>

    <logger name="reactor.netty.http.server.AccessLog" level="INFO" additivity="false">
        <appender-ref ref="async"/>
    </logger>