logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Sicker <boa...@gmail.com>
Subject Re: Dynamically creating loggers
Date Fri, 15 Apr 2016 14:13:15 GMT
Couldn't he just cache the LoggerContext and use LoggerContext.getLogger()
to avoid the ContextSelector lookup?

On 15 April 2016 at 08:19, Ralph Goers <ralph.goers@dslextreme.com> wrote:

> The logging implementation stores the logger in a map.  However, when you
> call getLogger ClassLoaderContextSelector will have to locate the
> ClassLoader for the class loading the Logger. This can be fairly expensive.
> If you are using a different ContextSelector it might work better. Or you
> can create a Map of the Loggers yourself.
>
> Ralph
>
> > On Apr 15, 2016, at 2:02 AM, Jochen Wiedmann <jochen.wiedmann@gmail.com>
> wrote:
> >
> > Hi,
> >
> > I've got an application, where I would like to obtain loggers on the
> > fly, because the logger name isn't known in advance. (Think of it as a
> > logging server, which will be used by remote clients.)
> >
> > Now, creating a Logger might be an expensive operation. Thus, my
> question:
> >
> > - Would you recommend to always invoke LogManager.getLogger(String)
> > and use the result?
> > - Or would it be better to maintain a Map<String,Logger> with the
> > logger name as key?
> >
> > Thanks,
> >
> > Jochen
> >
> > --
> > The next time you hear: "Don't reinvent the wheel!"
> >
> >
> http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
Matt Sicker <boards@gmail.com>

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