logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fred Eisele <fredrick.eis...@gmail.com>
Subject Re: Providing access to log/appender in application
Date Thu, 15 Aug 2019 16:13:11 GMT
Yes, that looks like what I want to do.

On Thu, Aug 15, 2019 at 8:33 AM Ralph Goers <ralph.goers@dslextreme.com>
wrote:

> 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.eisele@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-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message