If i enable tomcat access logs through logback as below
logback.access:
enabled: true
compile group: 'net.rakugakibox.spring.boot', name: 'logback-access-spring-boot-starter', version: '2.5.0'
configuration as below
<configuration>
<property name="LOG_HOME" value="${LOG_FILE_LOCATION:-/var/log/RSP}/${HOST_NAME}}"/>
<appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${LOG_HOME}/reservation_access.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/reservation_access-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>5MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>%h %l %u [%{TraceId}i] %t "%r" %s %b %D</pattern>
</encoder>
</appender>
<appender-ref ref="ACCESS" />
</configuration>
it's working fine, but i am not able to understand how it is picking %u, in documentation it's mentioned as Remote user that was authenticated
so how tomcat knows who is authenticated user or can any one provide the source code of how these access logs will be generated.(i have gone through the basic article what is Access Log Valve)
And if i enable access logs by using spring boot properties as below
server.tomcat.accesslog.pattern: '%h %l %u [%{TraceId}i] %t "%r" %s %b %D'
server.tomcat.accesslog.prefix: reservation_access
server.tomcat.accesslog.enabled: true
server.tomcat.accesslog.directory: /var/log/RSP/
server.tomcat.accesslog.suffix: .log
then %u is not working,
- so what is difference between these two versions?
- when access logs will be printed for each request i.e after executing all filters or as soon as the request reaches to server it will be printed ?
Thanks