|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Object org.apache.log4j.AppenderSkeleton com.taobao.metamorphosis.client.extension.log4j.StreamAppender
public class StreamAppender
字段摘要 | |
---|---|
protected int |
connectionPool
Connection pool size for producer |
protected CodecBuilder.Codec_Type |
encodeType
The encodeType variable is set to
Codec_Type.HESSIAN by default. |
protected boolean |
immediateFlush
Immediate flush means that the underlying writer or output stream will be flushed at the end of each append operation. |
protected AsyncMessageSessionFactory |
messageSessionFactory
|
protected OutputStream |
out
This is the quietWriter where we will write to. |
protected AsyncMessageProducer |
producer
|
protected String |
topic
Default topic is the same with name |
protected ZkUtils.ZKConfig |
zkConfig
|
从类 org.apache.log4j.AppenderSkeleton 继承的字段 |
---|
closed, errorHandler, headFilter, layout, name, tailFilter, threshold |
构造方法摘要 | |
---|---|
StreamAppender()
This default constructor does nothing. |
|
StreamAppender(org.apache.log4j.Layout layout,
OutputStream writer)
Instantiate a WriterAppender and set the output destination to writer . |
方法摘要 | |
---|---|
void |
activateOptions()
Does nothing. |
void |
append(org.apache.log4j.spi.LoggingEvent event)
This method is called by the AppenderSkeleton.doAppend(org.apache.log4j.spi.LoggingEvent) method. |
protected boolean |
checkEntryConditions()
This method determines if there is a sense in attempting to append. |
void |
close()
Close this appender instance. |
protected void |
closeWriter()
Close the underlying Writer . |
int |
getEncodeType()
|
boolean |
getImmediateFlush()
Returns value of the ImmediateFlush option. |
String |
getTopic()
|
boolean |
requiresLayout()
The WriterAppender requires a layout. |
protected void |
reset()
Clear internal references to the writer and other variables. |
void |
setEncodeType(int encodeType)
|
void |
setImmediateFlush(boolean value)
If the ImmediateFlush option is set to true , the
appender will flush at the end of each write. |
void |
setName(String name)
Set the name of this Appender. |
void |
setTopic(String topic)
|
void |
setZkConnect(String zkConnect)
|
protected void |
subAppend(org.apache.log4j.spi.LoggingEvent event)
Actual writing occurs here. |
protected void |
writeFooter()
Write a footer as produced by the embedded layout's Layout.getFooter() method. |
protected void |
writeHeader()
Write a header as produced by the embedded layout's Layout.getHeader() method. |
从类 org.apache.log4j.AppenderSkeleton 继承的方法 |
---|
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setThreshold |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
字段详细信息 |
---|
protected boolean immediateFlush
immediateFlush
is set to false
, then there is a
good chance that the last few logs events are not actually written to
persistent media if and when the application crashes.
The immediateFlush
variable is set to true
by
default.
protected OutputStream out
quietWriter
where we will write to.
protected String topic
protected CodecBuilder.Codec_Type encodeType
encodeType
variable is set to
Codec_Type.HESSIAN
by default.
protected int connectionPool
protected AsyncMessageSessionFactory messageSessionFactory
protected AsyncMessageProducer producer
protected ZkUtils.ZKConfig zkConfig
构造方法详细信息 |
---|
public StreamAppender()
public StreamAppender(org.apache.log4j.Layout layout, OutputStream writer)
writer
.
The writer
must have been previously opened by the user.
方法详细信息 |
---|
public void setImmediateFlush(boolean value)
true
, the
appender will flush at the end of each write. This is the default
behavior. If the option is set to false
, then the underlying
stream can defer writing to physical medium to a later time.
Avoiding the flush operation at the end of each append results in a performance gain of 10 to 20 percent. However, there is safety tradeoff involved in skipping flushing. Indeed, when flushing is skipped, then it is likely that the last few log events will not be recorded on disk when the application exits. This is a high price to pay even for a 20% performance gain.
public boolean getImmediateFlush()
public String getTopic()
public void setTopic(String topic)
public void setZkConnect(String zkConnect)
public int getEncodeType()
public void setEncodeType(int encodeType)
public void setName(String name)
org.apache.log4j.Appender
中的 setName
org.apache.log4j.AppenderSkeleton
中的 setName
public void activateOptions()
org.apache.log4j.spi.OptionHandler
中的 activateOptions
org.apache.log4j.AppenderSkeleton
中的 activateOptions
public void append(org.apache.log4j.spi.LoggingEvent event)
AppenderSkeleton.doAppend(org.apache.log4j.spi.LoggingEvent)
method.
If the output stream exists and is writable then write a log statement to
the output stream. Otherwise, write a single warning message to
System.err
.
The format of the output will depend on this appender's layout.
org.apache.log4j.AppenderSkeleton
中的 append
protected boolean checkEntryConditions()
It checks whether there is a set output target and also if there is a set
layout. If these checks fail, then the boolean value false
is returned.
protected void subAppend(org.apache.log4j.spi.LoggingEvent event)
Most subclasses of WriterAppender
will need to override this
method.
public void close()
Closed appenders cannot be reused.
org.apache.log4j.Appender
中的 close
org.apache.log4j.AppenderSkeleton
中的 close
#setWriter
protected void closeWriter()
Writer
.
public boolean requiresLayout()
true
.
org.apache.log4j.Appender
中的 requiresLayout
org.apache.log4j.AppenderSkeleton
中的 requiresLayout
protected void reset()
protected void writeFooter()
Layout.getFooter()
method.
protected void writeHeader()
Layout.getHeader()
method.
|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |