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.wiedm...@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-unsubscr...@logging.apache.org > For additional commands, e-mail: log4j-user-h...@logging.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org