Package io.helidon.webserver.accesslog
Class AccessLogSupport.Builder
- java.lang.Object
-
- io.helidon.webserver.accesslog.AccessLogSupport.Builder
-
- All Implemented Interfaces:
Builder<AccessLogSupport>
,Supplier<AccessLogSupport>
- Enclosing class:
- AccessLogSupport
public static final class AccessLogSupport.Builder extends Object implements Builder<AccessLogSupport>
A fluent API Builder forAccessLogSupport
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessLogSupport.Builder
add(AccessLogEntry entry)
Add aAccessLogEntry
to the list of log entries creating the format of this access log.AccessLogSupport
build()
Build the instance from this builder.AccessLogSupport.Builder
clock(Clock clock)
Configure an alternative clock to use, such asClock.fixed(java.time.Instant, java.time.ZoneId)
.AccessLogSupport.Builder
commonLogFormat()
Usecommon
log format.AccessLogSupport.Builder
config(Config config)
Update this builder from configuration.AccessLogSupport.Builder
enabled(boolean enabled)
Access logging can be disabled (either through configuration or explicitly in code.AccessLogSupport.Builder
helidonLogFormat()
Use Helidon log format.AccessLogSupport.Builder
logFormatString(String format)
The format for log entries (similar to the ApacheLogFormat
).AccessLogSupport.Builder
loggerName(String loggerName)
Name of the logger use to obtain access log logger fromLogger.getLogger(String)
.
-
-
-
Method Detail
-
build
public AccessLogSupport build()
Description copied from interface:Builder
Build the instance from this builder.- Specified by:
build
in interfaceBuilder<AccessLogSupport>
- Returns:
- instance of the built type
-
helidonLogFormat
public AccessLogSupport.Builder helidonLogFormat()
Use Helidon log format.Clears the current log entries and replaces them with Helidon log format.
Helidon log format uses the following log entries (in this order):
- Returns:
- updated builder instance
-
commonLogFormat
public AccessLogSupport.Builder commonLogFormat()
Usecommon
log format.Clears the current log entries and replaces them with
common
log format.common
log format uses the following log entries (in this order):- Returns:
- updated builder instance
-
logFormatString
public AccessLogSupport.Builder logFormatString(String format)
The format for log entries (similar to the ApacheLogFormat
).Log format elements %h IP address of the remote host HostLogEntry
%l The client identity. This is always undefined in Helidon. UserIdLogEntry
%u User ID as asserted by Helidon Security. UserLogEntry
%t The timestamp TimestampLogEntry
%r The request line ( "GET /favicon.ico HTTP/1.0"
)RequestLineLogEntry
%s The status code returned to the client StatusLogEntry
%b The entity size in bytes SizeLogEntry
%D The time taken in microseconds (start of request until last byte written) TimeTakenLogEntry
%T The time taken in seconds (start of request until last byte written), integer TimeTakenLogEntry
%{header-name}i Value of header header-name
HeaderLogEntry
- Parameters:
format
- format string, such as%h %l %u %t %r %b %{Referer}i
- Returns:
- updated builder instance
-
add
public AccessLogSupport.Builder add(AccessLogEntry entry)
Add aAccessLogEntry
to the list of log entries creating the format of this access log. Entries are separated by a space.- Parameters:
entry
- entry to add to the list of format entries- Returns:
- updated builder instance
-
enabled
public AccessLogSupport.Builder enabled(boolean enabled)
Access logging can be disabled (either through configuration or explicitly in code.- Parameters:
enabled
- whether to enable (true
) or disable (false
) access logging- Returns:
- updated builder instance
-
config
public AccessLogSupport.Builder config(Config config)
Update this builder from configuration. In caseformat
is specified in configuration, it would replace the currently configured format in this builder.- Parameters:
config
- configuration with Access log configuration options- Returns:
- updated builder instance
-
loggerName
public AccessLogSupport.Builder loggerName(String loggerName)
Name of the logger use to obtain access log logger fromLogger.getLogger(String)
. Defaults to "io.helidon.webserver.AccessLog".- Parameters:
loggerName
- name of the logger to use- Returns:
- updated builder instance
-
clock
public AccessLogSupport.Builder clock(Clock clock)
Configure an alternative clock to use, such asClock.fixed(java.time.Instant, java.time.ZoneId)
. Defaults toClock.systemDefaultZone()
.- Parameters:
clock
- clock to use to get current times- Returns:
- updated builder instance
-
-