2 ms·
Also, btw, just for performance reasons - I wouldn't put a JNDI call into a log message anyway - even calling to somewhere local, it's not entirely free, and lo
by paulmd 4y ago
Also, btw, just for performance reasons - I wouldn't put a JNDI call into a log message anyway - even calling to somewhere local, it's not entirely free, and logging is highly performance-sensitive. I'm not sure if it's HTTP-based or what, maybe it's memory-based if local, but whatever it is, doing it thousands of times a second is wasteful.
It's not a "get the container name" call, it's a generic JNDI call, those values could change and the output probably can't be cached... so just for performance's sake I would get those values at application startup and then put them into the Mapped Diagnostic Context, which can be accessed via log4j pattern formatters. That way you're not calling out for every log message.