How to use AsyncAppender in log4j in order to write log message to the web service? Should I create my own Appender which would extend AsyncAppender or just attach custom appenders to the AsyncAppender? If the second choice is correct, where should I take the AsyncAppender object? Is there any example?
Share
Answering my own question.
In the log4j config file(usually it’s log4j.xml or log4j.properties) we should define AsyncAppender which would refer to a real appender(it may be our own defined class like in my case).
So I wrote a WebServiceAppender class which extends AppenderSkeleton and implements 3 abstract methods. The main method is “append” which connects to the web service and sends all the information to it. That’s it.