I would recommend you create a variant of the ListAppender. I wouldn’t 
recommend using it directly as it isn’t meant for production use. You will find 
this in log4j-core’s test classes. We make extensive use of this in our unit 
tests. If you look at one of the tests that use it you can see how it can be 
accessed from your code. Essentially, you get the configuration from the 
LoggerContext and then find the appender you want from that. 

Ralph

> On Aug 15, 2019, at 5:12 AM, Fred Eisele <fredrick.eis...@gmail.com> wrote:
> 
> My current application has a "log panel" where certain messages are posted.
> We are converting this application to use log4j2.
> What is a good way to route an appender to an in memory list of messages in
> the application?
> 
> * Construct an appender programmatically passing the java list to the
> constructor
> * Construct an appender based on either OutputStreamAppender or
> MemoryMappedFileAppender, and access its manager programmatically
> 
> 
> On a related note---
> Is it possible to programmatically access an appender by name without first
> going through a logger?



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to