开发者

Use Asynchronous appender with JMS appender in log4j

I want to know more details about AsyncAppender

lyk

Can we control retries if attached appender is not working?

How does it handle error if attached appender encounters the error

N how can I remove attached ap开发者_如何学Gopender from async appender....


As you know the AsyncAppender is just a wrapper for other appenders. When you create an AsyncAppender you have attach your "real" appenders to it.

The AsyncAppender will buffer your log messages until it has reached your configured limit and publish those log message to the attached appenders all at once.

From the code for AsyncAppender, it is looks like when the buffer is full it simply calls the doAppend method for each attached appender (simple for loop through all appenders). It would be up to the attached appenders to handle error conditions and retries.

I suggest implementing a custom appender by extending SkeletonAppender and handling everything yourself in the methods you override.

To answer your last question, AsyncAppender has a removeAppender method:

  public void removeAppender(final Appender appender) {
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜