org.apache.cxf.management.web.logging.atom
Class AtomPushHandler
java.lang.Object
java.util.logging.Handler
org.apache.cxf.management.web.logging.atom.AtomPushHandler
public final class AtomPushHandler
- extends Handler
Handler pushing log records in batches as Atom Feeds or Entries to registered client. Handler
responsibility is to adapt to JUL framework while most of job is delegated to AtomPushEngine.
For simple configuration using properties file (one global root-level handler of this class) following
properties prefixed with full name of this class can be used:
- url - URL where feeds will be pushed (mandatory parameter)
- batchSize - integer number specifying minimal number of published log records that trigger
processing and pushing ATOM document. If parameter is not set, is not greater than zero or is not a number,
batch size is set to 1.
Conversion of log records into ATOM Elements can be tuned up using following parameters. Note that not all
combinations are meaningful, see org.apache.cxf.jaxrs.ext.logging.atom.converter.StandardConverter
for details:
- output - ATOM Element type pushed out, either "feed" or "entry"; when not specified or invalid
value provided "feed" is used.
- multiplicity - multiplicity of subelement(entries in feed for output=="feed" or log records in
entry for output=="entry"), either "one" or "many"; when not specified or invalid value provided "one" is
used.
- format - method of embedding data in entry, either "content" or "extension"; when not specified
or invalid value provided "content" is used.
By default delivery is served by WebClientDeliverer which does not support reliability of transport.
Availability of any of this parameters enables retrying of default delivery. Detailed explanation of these
parameter, see org.apache.cxf.jaxrs.ext.logging.atom.deliverer.RetryingDeliverer class description.
- retry.pause - pausing strategy of delivery retries, either linear or exponential
value (mandatory parameter). If mispelled linear is used.
- retry.pause.time - pause time (in seconds) between retries. If parameter is not set, pause is
set to 30 seconds.
- retry.timeout - maximum time (in seconds) retrying will be continued. If not set timeout is not
set (infinite loop of retries).
Ultimate control on conversion and delivery is obtained specifying own implementation classes:
- converter - name of class implementing
Converter class replacing default conversion and
its specific parameters ("output", "multiplicity" and "format") are ignored. For classes located in same
package as Converter interface only class name can be given e.g. instead of
"org.apache.cxf.jaxrs.ext.logging.atom.converter.FooBarConverter" one can specify "FooBarConverter".
- deliverer - name of class implementing
Deliverer class replacing default delivery and
its specific parameters ("retry.Xxx") are ignored. For classes located in same package as Deliverer
interface only class name can be given e.g. instead of
"org.apache.cxf.jaxrs.ext.logging.atom.deliverer.WebClientDeliverer" one can specify
"WebClientDeliverer".
Example:
handlers = org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler, java.util.logging.ConsoleHandler
.level = INFO
# deliver to given URL triggering after each batch of 10 log records
org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.url = http://localhost:9080
org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.batchSize = 10
# enable retrying delivery every 10 seconds for 5 minutes
org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.retry.pause = linear
org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.retry.pause.time = 10
org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.retry.timeout = 300
# output for AtomPub: push entries not feeds, each entry with one log record as "atom:extension"
org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.output = entry
org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.multiplicity = one
org.apache.cxf.jaxrs.ext.logging.atom.AtomPushHandler.format = extension
...
| Methods inherited from class java.util.logging.Handler |
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AtomPushHandler
public AtomPushHandler()
- Creates handler with configuration taken from properties file.
AtomPushHandler
public AtomPushHandler(int batchSize,
Converter converter,
Deliverer deliverer)
- Creates handler with custom parameters.
- Parameters:
batchSize - batch size, see AtomPushEngine.getBatchSize()converter - converter transforming logs into ATOM elementsdeliverer - deliverer pushing ATOM elements to client
publish
public void publish(LogRecord record)
- Specified by:
publish in class Handler
close
public void close()
throws SecurityException
- Specified by:
close in class Handler
- Throws:
SecurityException
flush
public void flush()
- Specified by:
flush in class Handler
Apache CXF