Package io.helidon.webserver.accesslog
Class AccessLogSupport.Builder
- java.lang.Object
-
- io.helidon.webserver.accesslog.AccessLogSupport.Builder
-
- All Implemented Interfaces:
io.helidon.common.Builder<AccessLogSupport>,Supplier<AccessLogSupport>
- Enclosing class:
- AccessLogSupport
public static final class AccessLogSupport.Builder extends Object implements io.helidon.common.Builder<AccessLogSupport>
A fluent API Builder forAccessLogSupport.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessLogSupport.Builderadd(AccessLogEntry entry)Add aAccessLogEntryto the list of log entries creating the format of this access log.AccessLogSupportbuild()AccessLogSupport.Builderclock(Clock clock)Configure an alternative clock to use, such asClock.fixed(java.time.Instant, java.time.ZoneId).AccessLogSupport.BuildercommonLogFormat()Usecommonlog format.AccessLogSupport.Builderconfig(io.helidon.config.Config config)Update this builder from configuration.AccessLogSupport.Builderenabled(boolean enabled)Access logging can be disabled (either through configuration or explicitly in code.AccessLogSupport.BuilderexcludePaths(String... excludePaths)List of path patterns to exclude in access log.AccessLogSupport.BuilderexcludePaths(List<String> excludePaths)List of path patterns to exclude in access log.AccessLogSupport.BuilderhelidonLogFormat()Use Helidon log format.AccessLogSupport.BuilderlogFormatString(String format)The format for log entries (similar to the ApacheLogFormat).AccessLogSupport.BuilderloggerName(String loggerName)Name of the logger use to obtain access log logger fromLogger.getLogger(String).
-
-
-
Method Detail
-
build
public AccessLogSupport build()
- Specified by:
buildin interfaceio.helidon.common.Builder<AccessLogSupport>
-
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()
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
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-nameHeaderLogEntry- 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 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
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(io.helidon.config.Config 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
-
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
-
excludePaths
public AccessLogSupport.Builder excludePaths(String... excludePaths)
List of path patterns to exclude in access log.- Parameters:
excludePaths- list of exclude paths- Returns:
- updated builder instance
- See Also:
PathMatcher
-
excludePaths
public AccessLogSupport.Builder excludePaths(List<String> excludePaths)
List of path patterns to exclude in access log.- Parameters:
excludePaths- list of exclude paths- Returns:
- updated builder instance
- See Also:
PathMatcher
-
-