Package org.apache.catalina.valves
Class JsonAccessLogValve
- All Implemented Interfaces:
MBeanRegistration
,AccessLog
,Contained
,JmxEnabled
,Lifecycle
,Valve
Access log valve derivative that rewrites entries as JSON.
Important note: the attribute names are not final.
Patterns are mapped to attributes as followed:
- a: remoteAddr
- A: localAddr
- b: size (byteSent: size)
- B: byteSentNC
- D: elapsedTime
- F: firstByteTime
- h: host
- H: protocol
- l: logicalUserName
- m: method
- p: port
- q: query
- r: request
- s: statusCode
- S: sessionId
- t: time (dateTime: time)
- T: elapsedTimeS
- u: user
- U: path (requestURI: path)
- v: localServerName
- I: threadName
- X: connectionStatus
- %{xxx}a: remoteAddress-xxx
- %{xxx}p: port-xxx
- %{xxx}t: time-xxx
- %{xxx}c: cookies
- %{xxx}i: requestHeaders
- %{xxx}o: responseHeaders
- %{xxx}r: requestAttributes
- %{xxx}s: sessionAttributes
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
write any charNested classes/interfaces inherited from class org.apache.catalina.valves.AbstractAccessLogValve
AbstractAccessLogValve.AccessLogElement, AbstractAccessLogValve.ByteSentElement, AbstractAccessLogValve.CachedElement, AbstractAccessLogValve.ConnectionStatusElement, AbstractAccessLogValve.CookieElement, AbstractAccessLogValve.DateAndTimeElement, AbstractAccessLogValve.DateFormatCache, AbstractAccessLogValve.ElapsedTimeElement, AbstractAccessLogValve.FirstByteTimeElement, AbstractAccessLogValve.HeaderElement, AbstractAccessLogValve.HostElement, AbstractAccessLogValve.HttpStatusCodeElement, AbstractAccessLogValve.LocalAddrElement, AbstractAccessLogValve.LocalServerNameElement, AbstractAccessLogValve.LogicalUserNameElement, AbstractAccessLogValve.MethodElement, AbstractAccessLogValve.PortElement, AbstractAccessLogValve.ProtocolElement, AbstractAccessLogValve.QueryElement, AbstractAccessLogValve.RemoteAddrElement, AbstractAccessLogValve.RequestAttributeElement, AbstractAccessLogValve.RequestElement, AbstractAccessLogValve.RequestURIElement, AbstractAccessLogValve.ResponseHeaderElement, AbstractAccessLogValve.SessionAttributeElement, AbstractAccessLogValve.SessionIdElement, AbstractAccessLogValve.StringElement, AbstractAccessLogValve.ThreadNameElement, AbstractAccessLogValve.UserElement
Nested classes/interfaces inherited from interface org.apache.catalina.Lifecycle
Lifecycle.SingleUse
-
Field Summary
Fields inherited from class org.apache.catalina.valves.AccessLogValve
currentLogFile, encoding, fileDateFormat, fileDateFormatter, prefix, renameOnRotate, rotatable, suffix, writer
Fields inherited from class org.apache.catalina.valves.AbstractAccessLogValve
cachedElements, condition, conditionIf, enabled, locale, localeName, logElements, pattern, requestAttributesEnabled
Fields inherited from class org.apache.catalina.valves.ValveBase
asyncSupported, container, containerLog, next, sm
Fields inherited from interface org.apache.catalina.AccessLog
PROTOCOL_ATTRIBUTE, REMOTE_ADDR_ATTRIBUTE, REMOTE_HOST_ATTRIBUTE, SERVER_NAME_ATTRIBUTE, SERVER_PORT_ATTRIBUTE
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected AbstractAccessLogValve.AccessLogElement
createAccessLogElement
(char pattern) Create an AccessLogElement implementation.protected AbstractAccessLogValve.AccessLogElement
createAccessLogElement
(String name, char pattern) Create an AccessLogElement implementation which needs an element name.protected AbstractAccessLogValve.AccessLogElement[]
Parse pattern string and create the array of AccessLogElement.Methods inherited from class org.apache.catalina.valves.AccessLogValve
backgroundProcess, getDirectory, getEncoding, getFileDateFormat, getMaxDays, getPrefix, getSuffix, isBuffered, isCheckExists, isRenameOnRotate, isRotatable, log, open, rotate, rotate, setBuffered, setCheckExists, setDirectory, setEncoding, setFileDateFormat, setMaxDays, setPrefix, setRenameOnRotate, setRotatable, setSuffix, startInternal, stopInternal
Methods inherited from class org.apache.catalina.valves.AbstractAccessLogValve
escapeAndAppend, findLocale, getCondition, getConditionIf, getConditionUnless, getEnabled, getIpv6Canonical, getLocale, getMaxLogMessageBufferSize, getPattern, getRequestAttributesEnabled, invoke, log, setCondition, setConditionIf, setConditionUnless, setEnabled, setIpv6Canonical, setLocale, setMaxLogMessageBufferSize, setPattern, setRequestAttributesEnabled
Methods inherited from class org.apache.catalina.valves.ValveBase
getContainer, getDomainInternal, getNext, getObjectNameKeyProperties, initInternal, isAsyncSupported, setAsyncSupported, setContainer, setNext, toString
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase
destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregister
Methods inherited from class org.apache.catalina.util.LifecycleBase
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
-
Constructor Details
-
JsonAccessLogValve
public JsonAccessLogValve()
-
-
Method Details
-
createLogElements
Description copied from class:AbstractAccessLogValve
Parse pattern string and create the array of AccessLogElement.- Overrides:
createLogElements
in classAbstractAccessLogValve
- Returns:
- the log elements array
-
createAccessLogElement
Description copied from class:AbstractAccessLogValve
Create an AccessLogElement implementation which needs an element name.- Overrides:
createAccessLogElement
in classAbstractAccessLogValve
- Parameters:
name
- Header namepattern
- char in the log pattern- Returns:
- the log element
-
createAccessLogElement
Description copied from class:AbstractAccessLogValve
Create an AccessLogElement implementation.- Overrides:
createAccessLogElement
in classAbstractAccessLogValve
- Parameters:
pattern
- char in the log pattern- Returns:
- the log element
-