|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.log4j.AppenderSkeleton
org.apache.flume.clients.log4jappender.Log4jAppender
public class Log4jAppender
Appends Log4j Events to an external Flume client which is decribed by the Log4j configuration file. The appender takes two required parameters:
Hostname : This is the hostname of the first hop at which Flume (through an AvroSource) is listening for events.
Port : This the port on the above host where the Flume Source is listening for events.
A sample log4j properties file which appends to a source would look like:log4j.appender.out2 = org.apache.flume.clients.log4jappender.Log4jAppender log4j.appender.out2.Port = 25430 log4j.appender.out2.Hostname = foobarflumesource.com 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 | |
|---|---|
Log4jAppender()
If this constructor is used programmatically rather than from a log4j conf you must set the port and hostname and then call activateOptions() before calling append(). |
|
Log4jAppender(String hostname,
int port)
Sets the hostname and port. |
|
| Method Summary | |
|---|---|
void |
activateOptions()
Activate the options set using setPort() and setHostname() |
void |
append(org.apache.log4j.spi.LoggingEvent event)
Append the LoggingEvent, to send to the first Flume hop. |
void |
close()
Closes underlying client. |
boolean |
requiresLayout()
|
void |
setHostname(String hostname)
Set the first flume hop hostname. |
void |
setPort(int port)
Set the port on the hostname to connect to. |
| 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 Log4jAppender()
public Log4jAppender(String hostname,
int port)
hostname - The first hop where the client should connect to.port - The port to connect on the host.| Method Detail |
|---|
public void append(org.apache.log4j.spi.LoggingEvent event)
throws FlumeException
append in class org.apache.log4j.AppenderSkeletonevent - The LoggingEvent to be appended to the flume.
FlumeException - if the appender was closed,
or the hostname and port were not setup, there was a timeout, or there
was a connection error.
public void close()
throws FlumeException
FlumeException - if errors occur during closepublic boolean requiresLayout()
public void setHostname(String hostname)
hostname - The first hop where the client should connect to.public void setPort(int port)
port - The port to connect on the host.
public void activateOptions()
throws FlumeException
activateOptions in interface org.apache.log4j.spi.OptionHandleractivateOptions in class org.apache.log4j.AppenderSkeletonFlumeException - if the hostname and
port combination is invalid.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||