Package io.helidon.webserver.accesslog
Class AccessLogFeature.Builder
java.lang.Object
io.helidon.webserver.accesslog.AccessLogFeature.Builder
- All Implemented Interfaces:
io.helidon.common.Builder<AccessLogFeature.Builder,,AccessLogFeature> Supplier<AccessLogFeature>
- Enclosing class:
AccessLogFeature
public static final class AccessLogFeature.Builder
extends Object
implements io.helidon.common.Builder<AccessLogFeature.Builder,AccessLogFeature>
A fluent API Builder for
AccessLogFeature.-
Method Summary
Modifier and TypeMethodDescriptionadd(AccessLogEntry entry) Add aAccessLogEntryto the list of log entries creating the format of this access log.build()Configure an alternative clock to use, such asClock.fixed(java.time.Instant, java.time.ZoneId).Usecommonlog format.config(io.helidon.config.Config config) 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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.helidon.common.Builder
get, identity, update
-
Method Details
-
build
- Specified by:
buildin interfaceio.helidon.common.Builder<AccessLogFeature.Builder,AccessLogFeature>
-
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
Usecommonlog format.Clears the current log entries and replaces them with
commonlog format.commonlog 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-nameHeaderLogEntry- Parameters:
format- format string, such as%h %l %u %t %r %b %{Referer}i- Returns:
- updated builder instance
-
add
Add aAccessLogEntryto 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 caseformatis 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
-