Private static final Log log = LogFactory.getLog(MyClass.class);
It is a good idea to store the log instance in a static final variable, because:
- No problems with serializable classes
- Initialization cost only once: getLog() may not be as cheap as you might think
- Automatically thread-safe, only if the final keyword is included
- Usable from static and non-static code
Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.




















