|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.log4j.AppenderSkeleton org.apache.flume.clients.log4jappender.Log4jAppender org.apache.flume.clients.log4jappender.LoadBalancingLog4jAppender
public class LoadBalancingLog4jAppender
Appends Log4j Events to an external Flume client which is decribed by the Log4j configuration file. The appender takes the following required parameters:
Hosts : A space separated list of host:port of the first hop at which Flume (through an AvroSource) is listening for events.
Selector : Selection mechanism. Must be either ROUND_ROBIN, RANDOM or custom FQDN to class that inherits from LoadBalancingSelector. If empty defaults to ROUND_ROBIN
The appender also takes the following optional parameters:MaxBackoff : A long value representing the maximum amount of time in milliseconds the Load balancing client will backoff from a node that has failed to consume an event
A sample log4j properties file which appends to a source would look like:log4j.appender.out2 = org.apache.flume.clients.log4jappender.LoadBalancingLog4jAppender log4j.appender.out2.Hosts = fooflumesource.com:25430 barflumesource.com:25430 log4j.appender.out2.Selector = RANDOM log4j.logger.org.apache.flume.clients.log4jappender = DEBUG,out2
log4j.appender.out2 = org.apache.flume.clients.log4jappender.LoadBalancingLog4jAppender log4j.appender.out2.Hosts = fooflumesource.com:25430 barflumesource.com:25430 log4j.appender.out2.Selector = ROUND_ROBIN log4j.appender.out2.MaxBackoff = 60000 log4j.logger.org.apache.flume.clients.log4jappender = DEBUG,out2
Note: Change the last line to the package of the class(es), that will do the appending.For example if classes from the package com.bar.foo are appending, the last line would be:
log4j.logger.com.bar.foo = DEBUG,out2
Field Summary |
---|
Fields inherited from class org.apache.log4j.AppenderSkeleton |
---|
closed, errorHandler, headFilter, layout, name, tailFilter, threshold |
Constructor Summary | |
---|---|
LoadBalancingLog4jAppender()
|
Method Summary | |
---|---|
void |
activateOptions()
Activate the options set using setHosts(), setSelector and setMaxBackoff |
void |
append(org.apache.log4j.spi.LoggingEvent event)
Append the LoggingEvent, to send to the first Flume hop. |
void |
setHosts(String hostNames)
|
void |
setMaxBackoff(String maxBackoff)
|
void |
setSelector(String selector)
|
Methods inherited from class org.apache.flume.clients.log4jappender.Log4jAppender |
---|
close, getTimeout, getUnsafeMode, populateAvroHeaders, requiresLayout, setAvroReflectionEnabled, setAvroSchemaUrl, setHostname, setPort, setTimeout, setUnsafeMode |
Methods inherited from class org.apache.log4j.AppenderSkeleton |
---|
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LoadBalancingLog4jAppender()
Method Detail |
---|
public void setHosts(String hostNames)
public void setSelector(String selector)
public void setMaxBackoff(String maxBackoff)
public void append(org.apache.log4j.spi.LoggingEvent event)
Log4jAppender
append
in class Log4jAppender
event
- The LoggingEvent to be appended to the flume.public void activateOptions() throws FlumeException
activateOptions
in interface org.apache.log4j.spi.OptionHandler
activateOptions
in class Log4jAppender
FlumeException
- if the LoadBalancingRpcClient cannot be instantiated.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |