public final class PEAccessLogValve extends ValveBase implements Runnable
Implementation of the Valve interface that generates a web server
access log with the detailed line contents matching a configurable pattern.
The syntax of the available patterns is similar to that supported by the
Apache mod_log_config module. As an additional feature,
automatic rollover of log files at a specified interval is also supported.
ByteBuffer to store and write
logs.container, controller, debug, domain, lifecycle, log, next, oname, rb, startedAFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, INIT_EVENT, START_EVENT, STOP_EVENTEND_PIPELINE, INVOKE_NEXT| Constructor and Description |
|---|
PEAccessLogValve() |
| Modifier and Type | Method and Description |
|---|---|
void |
addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component.
|
List<LifecycleListener> |
findLifecycleListeners()
Gets the (possibly empty) list of lifecycle listeners associated
with this PEAccessLogValve.
|
int |
geRotationInterval()
Return rotation interval
|
int |
getBufferSize()
Return the direct
ByteBuffer size |
String |
getCondition()
Return whether the attribute name to look for when
performing conditional loggging.
|
String |
getDirectory()
Return the directory in which we create log files.
|
String |
getFileDateFormat()
Return the date format date based log rotation.
|
String |
getInfo()
Return descriptive information about this implementation.
|
String |
getPrefix()
Return the log file prefix.
|
String |
getSuffix()
Return the log file suffix.
|
int |
getWriterInterval()
Return writerThread interval (seconds)
|
int |
invoke(Request request,
Response response)
Log a message summarizing the specified request and response, according
to the format specified by the
pattern property. |
boolean |
isResolveHosts()
Get the value of the resolve hosts flag.
|
boolean |
isRotatable()
Should we rotate the logs
|
void |
log()
Log the specified message to the log file, switching files if the date
has changed since the previous log call.
|
void |
postInvoke(Request request,
Response response)
A post-request processing implementation that does nothing.
|
void |
removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component.
|
void |
run()
The background writerThread that checks for write the log.
|
void |
setAddDateStampToFirstAccessLogFile(boolean add)
Are we supposed to add datestamp to first access log file we create,
or only starting with first rotation?
|
void |
setBufferSize(int size)
Set the direct
ByteBuffer size |
void |
setCondition(String condition)
Set the ServletRequest.attribute to look for to perform
conditional logging.
|
void |
setDirectory(String directory)
Set the directory in which we create log files.
|
void |
setFileDateFormat(String fileDateFormat)
Set the date format date based log rotation.
|
void |
setPattern(String p)
Set the format pattern, first translating any recognized alias.
|
void |
setPrefix(String p)
Set the log file prefix.
|
void |
setResolveHosts(boolean resolveHosts)
Set the resolve hosts flag.
|
void |
setRotatable(boolean rotatable)
Set the value is we should we rotate the logs
|
void |
setRotationInterval(int t)
Set rotation interval
|
void |
setSuffix(String s)
Set the log file suffix.
|
void |
setWriterInterval(int t)
Set writerthread interval (seconds)
|
void |
start()
Prepare for the beginning of active use of the public methods of this
component.
|
void |
stop()
Gracefully terminate the active use of the public methods of this
component.
|
backgroundProcess, createObjectName, event, getContainer, getController, getDebug, getDomain, getNext, getObjectName, getParentName, invoke, isStarted, setContainer, setController, setDebug, setNext, setObjectNamepublic int getWriterInterval()
public void setWriterInterval(int t)
t - public int geRotationInterval()
public void setRotationInterval(int t)
public void setBufferSize(int size)
ByteBuffer sizesize - public int getBufferSize()
ByteBuffer sizepublic void setAddDateStampToFirstAccessLogFile(boolean add)
public String getDirectory()
public void setDirectory(String directory)
directory - The new log file directorypublic String getInfo()
public void setPattern(String p)
p - The new patternpublic String getPrefix()
public void setPrefix(String p)
p - prefix The new log file prefixpublic boolean isRotatable()
public void setRotatable(boolean rotatable)
rotatable - true is we should rotate.public String getSuffix()
public void setSuffix(String s)
s - suffix The new log file suffixpublic void setResolveHosts(boolean resolveHosts)
resolveHosts - The new resolve hosts valuepublic boolean isResolveHosts()
public String getCondition()
public void setCondition(String condition)
condition - Set to null to log everythingpublic String getFileDateFormat()
public void setFileDateFormat(String fileDateFormat)
fileDateFormat - public int invoke(Request request, Response response)
pattern property.invoke in interface GlassFishValveinvoke in class ValveBaserequest - Request being processedresponse - Response being processedpublic void postInvoke(Request request, Response response) throws IOException
ValveBasepostInvoke in interface GlassFishValvepostInvoke in class ValveBaserequest - The servlet request to be processedresponse - The servlet response to be createdIOException - if an input/output error occurspublic void log()
throws IOException
IOExceptionpublic void addLifecycleListener(LifecycleListener listener)
addLifecycleListener in interface LifecycleaddLifecycleListener in class ValveBaselistener - The listener to addpublic List<LifecycleListener> findLifecycleListeners()
findLifecycleListeners in interface LifecyclefindLifecycleListeners in class ValveBasepublic void removeLifecycleListener(LifecycleListener listener)
removeLifecycleListener in interface LifecycleremoveLifecycleListener in class ValveBaselistener - The listener to addpublic void start()
throws LifecycleException
configure(),
and before any of the public methods of the component are utilized.start in interface Lifecyclestart in class ValveBaseLifecycleException - if this component detects a fatal error
that prevents this component from being usedpublic void stop()
throws LifecycleException
stop in interface Lifecyclestop in class ValveBaseLifecycleException - if this component detects a fatal error
that needs to be reportedCopyright © 2017. All rights reserved.