|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.w3c.tools.resources.AttributeHolder org.w3c.tools.resources.Resource org.w3c.tools.resources.FramedResource org.w3c.tools.resources.ResourceFrame org.w3c.tools.resources.ResourceFilter org.w3c.jigsaw.filters.LogFilter
public class LogFilter
This filter provides a very flexible logger. It is not designed as a logger, in order to be plugable only on a sub-tree of the URL space (a logger would log all site accesses). It provides as much details as you want, and uses a very simple format: each log entry (or record is made of several lines having the folowing format:
variable=valueA record starts with the special
url
variable value which
provides the requested URL. The for each header that is to be logged,
a variable is added in the record, prefixed by its scope. The
scope can be either:
url=http://www.w3.org/pub/WWW/Jigsaw/ request.referer=http://www.w3.org/pub/WWW reply.content-length=10
Field Summary | |
---|---|
protected static int |
ATTR_LOGFILE
Attribute index - The log file to use to emit log record. |
protected static int |
ATTR_REPLY_HEADERS
Attribute index - The HTTP reply headers to dump |
protected static int |
ATTR_REQUEST_HEADERS
Attribute index - The HTTP request headers to dump |
static java.lang.String |
DONT_LOG
Name of the state that when set on the request will prevent logging. |
protected java.io.RandomAccessFile |
log
Open log descriptor, to write to the log. |
protected HeaderDescription[] |
repheaders
Compiled index of the reply headers to dump. |
protected HeaderDescription[] |
reqheaders
Compiled index of the request headers to dump. |
Fields inherited from class org.w3c.tools.resources.ResourceFrame |
---|
filterClass, frameListener, resource |
Fields inherited from class org.w3c.tools.resources.FramedResource |
---|
ATTR_OID, attrListener, debugEvent, event_disabled, framesRef, structListener |
Fields inherited from class org.w3c.tools.resources.Resource |
---|
ATTR_CONTEXT, ATTR_HELP_URL, ATTR_IDENTIFIER, ATTR_LAST_MODIFIED, ATTR_PARENT, ATTR_RESOURCE_FRAMES, ATTR_STORE_ENTRY, ATTR_URL, co, id |
Fields inherited from class org.w3c.tools.resources.AttributeHolder |
---|
attributes, values |
Constructor Summary | |
---|---|
LogFilter()
|
Method Summary | |
---|---|
protected HeaderDescription[] |
compileHeaders(HttpMessage kind,
java.lang.String[] headers)
Compile the given set of header names into header indexes. |
java.io.File |
getLogfile()
Get the log file. |
java.lang.String[] |
getReplyHeaders()
Get the list of reply headers to dump. |
java.lang.String[] |
getRequestHeaders()
Get the list of request headers to dump. |
void |
initialize(java.lang.Object[] values)
Initialize the filter. |
protected void |
log(Request request,
Reply reply)
Log the given request/reply transaction. |
protected void |
openLog()
Open the log stream, and make it available through log . |
ReplyInterface |
outgoingFilter(RequestInterface req,
ReplyInterface rep)
Log the request. |
void |
setValue(int idx,
java.lang.Object value)
Traop setValue calls. |
protected void |
writelog(java.lang.String record)
Write the given string to the log file. |
Methods inherited from class org.w3c.tools.resources.ResourceFilter |
---|
exceptionFilter, getTargetResource, ingoingFilter, ingoingFilter, initialize, lookup, outgoingFilter, outputFilter, pickleValues |
Methods inherited from class org.w3c.tools.resources.ResourceFrame |
---|
addFrameEventListener, attributeChanged, checkRequest, eventDisabled, fireFrameEvent, frameModified, getFilters, getFilters, getFrameReference, getResource, getResourceReference, getSpaceEntry, getURLPath, lookupFilters, lookupFrames, perform, postFrameEvent, processEvent, registerResource, removeFrameEventListener, unregisterResource, updateDefaultChildAttributes |
Methods inherited from class org.w3c.tools.resources.Resource |
---|
acceptUnload, checkMultipleLock, collectFrames, getContext, getFrame, getFrames, getHelpURL, getHelpURL, getIdentifier, getLastModified, getParent, getServer, getSpace, getStoreEntry, getValue, getValue, isInitialized, isUnloaded, setContext, setContext, setValue, unsafeGetContext, unsafeGetFrame, unsafeGetFrames, unsafeGetIdentifier, unsafeGetResourceReference, unsafeGetURLPath, unsafeGetValue, updateAttributes |
Methods inherited from class org.w3c.tools.resources.AttributeHolder |
---|
definesAttribute, definesAttribute, getAttributes, getBoolean, getChar, getClone, getClone, getDouble, getFloat, getInt, getLong, getString, getValue, lookupAttribute, print, setBoolean, setChar, setDouble, setFloat, setInt, setLong, setString, setValue, unsafeDefinesAttribute, unsafeGetDouble, unsafeGetString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DONT_LOG
protected static int ATTR_REQUEST_HEADERS
protected static int ATTR_REPLY_HEADERS
protected static int ATTR_LOGFILE
protected HeaderDescription[] reqheaders
protected HeaderDescription[] repheaders
protected java.io.RandomAccessFile log
Constructor Detail |
---|
public LogFilter()
Method Detail |
---|
protected HeaderDescription[] compileHeaders(HttpMessage kind, java.lang.String[] headers)
kind
- An instance of the class whose headers are to be dumped.headers
- The name of headers to compile.
protected void writelog(java.lang.String record)
record
- The string to write.protected void openLog()
log
.
If opening the stream failed, an appropriate error message is emitted
and log
remains set to null. If a log
stream was already opened, it is first closed.
public java.io.File getLogfile()
public java.lang.String[] getRequestHeaders()
public java.lang.String[] getReplyHeaders()
public void setValue(int idx, java.lang.Object value)
request-headers
and the reply-headers
attributes, make sure they stay in
sync even when modified.
setValue
in class ResourceFrame
idx
- The index of the attribute to modify.value
- The new attribute value.protected void log(Request request, Reply reply)
request
- The request to log.reply
- It's associated reply.public ReplyInterface outgoingFilter(RequestInterface req, ReplyInterface rep) throws ProtocolException
outgoingFilter
in class ResourceFilter
request
- The request that has been handled.reply
- It's associated reply.
ProtocolException
- If processing should be interrupted, because an abnormal situation
occured.public void initialize(java.lang.Object[] values)
initialize
in class FramedResource
values
- Default attribute values.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |