public class AccessLogBuilder extends Object
If the format is left unspecified, the default Apache combined format will be used.
If the time zone is left unspecified,
the default time zone
will be used.
Constructor and Description |
---|
AccessLogBuilder(File file)
Create a new
AccessLogBuilder writing logs to the specified file. |
AccessLogBuilder(String file)
Create a new
AccessLogBuilder writing logs to the specified file. |
Modifier and Type | Method and Description |
---|---|
AccessLogProbe |
build()
Build an
AccessLogProbe instance which can be injected into an
HttpServer 's monitoring
configuration to provide access logging. |
AccessLogBuilder |
format(AccessLogFormat format)
Set the
AccessLogFormat instance that will be used by the
access logs configured by this instance. |
AccessLogBuilder |
format(String format)
Set the format as a
String compatible with the default
Apache access log format that will be used
by the access logs configured by this instance. |
ServerConfiguration |
instrument(ServerConfiguration serverConfiguration)
Build an
AccessLogProbe instance and directly instrument it in an
HttpServer 's monitoring
configuration to provide access logging. |
AccessLogBuilder |
rotatedDaily()
Set up automatic log-file rotation, on a daily basis.
|
AccessLogBuilder |
rotatedHourly()
Set up automatic log-file rotation, on a hourly basis.
|
AccessLogBuilder |
rotationPattern(String rotationPattern)
Set up automatic log-file rotation based on a specified
SimpleDateFormat pattern. |
AccessLogBuilder |
statusThreshold(int statusThreshold)
Set the minimum response status that will trigger an entry
in an access log configured by this instance.
|
AccessLogBuilder |
synchronous(boolean synchronous)
Specify whether access log entries should be written
|
AccessLogBuilder |
timeZone(String timeZone)
Set the time zone that will be used to represent dates.
|
AccessLogBuilder |
timeZone(TimeZone timeZone)
Set the time zone that will be used to represent dates.
|
public AccessLogBuilder(String file)
AccessLogBuilder
writing logs to the specified file.file
- The location of the access log file.public AccessLogBuilder(File file)
AccessLogBuilder
writing logs to the specified file.file
- The location of the access log file.public AccessLogProbe build()
AccessLogProbe
instance which can be injected into an
HttpServer
's monitoring
configuration to provide access logging.public ServerConfiguration instrument(ServerConfiguration serverConfiguration)
AccessLogProbe
instance and directly instrument it in an
HttpServer
's monitoring
configuration to provide access logging.serverConfiguration
- The ServerConfiguration
to instrument.public AccessLogBuilder format(AccessLogFormat format)
AccessLogFormat
instance that will be used by the
access logs configured by this instance.public AccessLogBuilder format(String format)
String
compatible with the default
Apache access log format that will be used
by the access logs configured by this instance.public AccessLogBuilder timeZone(TimeZone timeZone)
public AccessLogBuilder timeZone(String timeZone)
The time zone will be looked up by time zone identifier, and if this is invalid or unrecognized, it will default to GMT.
public AccessLogBuilder statusThreshold(int statusThreshold)
For example a threshold of 500
will only generate log
entries for requests that terminated in error.
public AccessLogBuilder rotatedHourly()
For example, if the file name specified at
construction was
access.log
, files will be archived on a hourly basis
with names like access-yyyyMMDDhh.log
.
public AccessLogBuilder rotatedDaily()
For example, if the file name specified at
construction was
access.log
, files will be archived on a daily basis
with names like access-yyyyMMDD.log
.
public AccessLogBuilder rotationPattern(String rotationPattern)
SimpleDateFormat
pattern.
For example, if the file name specified at
construction was
access.log
and the rotation pattern specified
here is EEE
(day name in week), files will be
archived on a daily basis with names like
access-Mon.log
, access-Tue.log
, ...
public AccessLogBuilder synchronous(boolean synchronous)
If false (the default) a QueueingAppender
will be used
to enqueue entries and append to the final appenders when possible.
Copyright © 2015 Oracle Corporation. All rights reserved.