I know that stateless bean doesn't maintain conversational state but what I need is just a logger. Should I get logger in every method which is called? If not then where should I initialize it?
Is that's for sure that if I write such code I won't get NullPointerException in some method which uses logger?
@PostConstruct
public void init() {
logger = Logger.getLogger();
}
I guess you'd not want to have a request/session specific logger, right? In that case you could even use a static class member to add the logger and let all bean instances use the same logger.