Class AccessLogBuilder
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.
- Author:
- Pier Fumagalli, USRZ.com
-
Constructor Summary
ConstructorsConstructorDescriptionAccessLogBuilder(File file) Create a newAccessLogBuilderwriting logs to the specified file.AccessLogBuilder(String file) Create a newAccessLogBuilderwriting logs to the specified file. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build anAccessLogProbeinstance which can be injected into anHttpServer's monitoring configuration to provide access logging.Set the format as aStringcompatible with the default Apache access log format that will be used by the access logs configured by this instance.format(AccessLogFormat format) Set theAccessLogFormatinstance that will be used by the access logs configured by this instance.instrument(ServerConfiguration serverConfiguration) Build anAccessLogProbeinstance and directly instrument it in anHttpServer's monitoring configuration to provide access logging.Set up automatic log-file rotation, on a daily basis.Set up automatic log-file rotation, on a hourly basis.rotationPattern(String rotationPattern) Set up automatic log-file rotation based on a specifiedSimpleDateFormatpattern.statusThreshold(int statusThreshold) Set the minimum response status that will trigger an entry in an access log configured by this instance.synchronous(boolean synchronous) Specify whether access log entries should be writtensynchronously or not. Set the time zone that will be used to represent dates.Set the time zone that will be used to represent dates.
-
Constructor Details
-
AccessLogBuilder
Create a newAccessLogBuilderwriting logs to the specified file.- Parameters:
file- The location of the access log file.
-
AccessLogBuilder
Create a newAccessLogBuilderwriting logs to the specified file.- Parameters:
file- The location of the access log file.
-
-
Method Details
-
build
Build anAccessLogProbeinstance which can be injected into anHttpServer's monitoring configuration to provide access logging. -
instrument
Build anAccessLogProbeinstance and directly instrument it in anHttpServer's monitoring configuration to provide access logging.- Parameters:
serverConfiguration- TheServerConfigurationto instrument.
-
format
Set theAccessLogFormatinstance that will be used by the access logs configured by this instance. -
format
Set the format as aStringcompatible with the default Apache access log format that will be used by the access logs configured by this instance. -
timeZone
Set the time zone that will be used to represent dates. -
timeZone
Set the time zone that will be used to represent dates.The time zone will be looked up by time zone identifier, and if this is invalid or unrecognized, it will default to GMT.
-
statusThreshold
Set the minimum response status that will trigger an entry in an access log configured by this instance.For example a threshold of
500will only generate log entries for requests that terminated in error. -
rotatedHourly
Set up automatic log-file rotation, on a hourly basis.For example, if the file name specified at construction was
access.log, files will be archived on a hourly basis with names likeaccess-yyyyMMDDhh.log. -
rotatedDaily
Set up automatic log-file rotation, on a daily basis.For example, if the file name specified at construction was
access.log, files will be archived on a daily basis with names likeaccess-yyyyMMDD.log. -
rotationPattern
Set up automatic log-file rotation based on a specifiedSimpleDateFormatpattern.For example, if the file name specified at construction was
access.logand the rotation pattern specified here isEEE(day name in week), files will be archived on a daily basis with names likeaccess-Mon.log,access-Tue.log, ... -
synchronous
Specify whether access log entries should be writtensynchronously or not. If false (the default) a
QueueingAppenderwill be used to enqueue entries and append to the final appenders when possible.
-