Package com.oorian.security
Class AccessLogger
java.lang.Object
com.oorian.security.AccessLogger
HTTP access logger for recording request information.
AccessLogger records HTTP request details in a configurable format, using the JDK
System.Logger SPI for output. This allows integration with any logging backend.
Supported Formats:
AccessLogFormat.COMMON— Common Log Format (CLF):host - - [date] "method path protocol" status sizeAccessLogFormat.COMBINED— Combined Log Format (adds referer and user agent)
Usage:
// In Application.initialize():
setAccessLoggingEnabled(true);
setAccessLogFormat(AccessLogFormat.COMBINED);
- Since:
- 2.1
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic AccessLogFormatReturns the current access log format.static booleanReturns whether access logging is enabled.static voidlog(OorianHttpRequest request, OorianHttpResponse response) Logs an HTTP request/response pair.static voidsetEnabled(boolean enabled) Enables or disables access logging.static voidsetFormat(AccessLogFormat format) Sets the access log format.
-
Method Details
-
setEnabled
public static void setEnabled(boolean enabled) Enables or disables access logging.- Parameters:
enabled-trueto enable
-
isEnabled
public static boolean isEnabled()Returns whether access logging is enabled.- Returns:
trueif enabled
-
setFormat
Sets the access log format.- Parameters:
format- the log format
-
getFormat
Returns the current access log format.- Returns:
- the log format
-
log
Logs an HTTP request/response pair.- Parameters:
request- the HTTP requestresponse- the HTTP response
-