Package io.helidon.webserver.accesslog
Class AccessLogRoutingFeature.Builder
java.lang.Object
io.helidon.webserver.accesslog.AccessLogRoutingFeature.Builder
- All Implemented Interfaces:
Builder<AccessLogRoutingFeature.Builder,
,AccessLogRoutingFeature> Supplier<AccessLogRoutingFeature>
- Enclosing class:
AccessLogRoutingFeature
public static final class AccessLogRoutingFeature.Builder
extends Object
implements Builder<AccessLogRoutingFeature.Builder,AccessLogRoutingFeature>
A fluent API Builder for
AccessLogRoutingFeature
.-
Method Summary
Modifier and TypeMethodDescriptionadd
(AccessLogEntry entry) Add aAccessLogEntry
to the list of log entries creating the format of this access log.build()
Build the instance from this builder.Configure an alternative clock to use, such asClock.fixed(java.time.Instant, java.time.ZoneId)
.Usecommon
log format.Update this builder from configuration.Use default log format.enabled
(boolean enabled) Access logging can be disabled (either through configuration or explicitly in code.logFormatString
(String format) The format for log entries (similar to the ApacheLogFormat
).loggerName
(String loggerName) Name of the logger use to obtain access log logger fromSystem.getLogger(String)
.weight
(double weight) Configure a new weight for this feature.
-
Method Details
-
build
Description copied from interface:Builder
Build the instance from this builder.- Specified by:
build
in interfaceBuilder<AccessLogRoutingFeature.Builder,
AccessLogRoutingFeature> - Returns:
- instance of the built type
-
defaultLogFormat
Use default log format.Clears the current log entries and replaces them with default log format.
Helidon log format uses the following log entries (in this order):
- Returns:
- updated builder instance
-
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
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
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
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
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
-
weight
Configure a new weight for this feature. Changing weight may change ordering of features.- Parameters:
weight
- new weight to use- Returns:
- updated builder
-
loggerName
Name of the logger use to obtain access log logger fromSystem.getLogger(String)
. Defaults to "io.helidon.webserver.AccessLog".- Parameters:
loggerName
- name of the logger to use- Returns:
- updated builder instance
-
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
-