This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
My question is that: How to get the Logger for my webapp ? I have designed 3 cases:
case 1: Getting a private static logger of each classes. As there are many StrutsAction classes, it seems the code is not tidy.
case 2: Write a single Logger common to the package, and ALL classes within the webapp will use this logger for logging.
case 3: Same as case 2, except I initialize a Logger during the SerletContext Initialization and put this as ServletContext attribute, then all StrutsAction class get the logger from Servlet Context during runtime.
Thus, prevent from using a static logger which is hardcoded in the StrutsAction class. However, I doubt if any significant overhead is added in the system.
Could any expert share your experience about this ?