DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Jakub is a Java EE developer since 2005 and occasionally a project manager, working currently with Iterate AS. He's highly interested in developer productivity (and tools like Maven and AOP/AspectJ), web frameworks, Java portals, testing and performance and works a lot with IBM technologies. A native to Czech Republic, he lives now in Oslo, Norway. Jakub is a DZone MVB and is not an employee of DZone and has posted 155 posts at DZone. You can read more from them at their website. View Full User Profile

Commons-logging Logger Instantiation

04.08.2010
| 2509 views |
  • submit to reddit
        How to instantiate a logger with commons-logging (though now I'd rather use SLF4j).
Notice that some prefer to have it static, some not, and somebody prefers the name "logger" to "LOG".

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
...
public class MyClass {

   private static final Log LOG = LogFactory.getLog(MyClass.class);
...