Is there a recommended idiom for declaring a logger in a class?
The following is the recommended logger declaration idiom. It assumes that your logger is a static variable of the class. package some.package; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MyClass { final static Logger logger = LoggerFactory.getLogger(MyClass.class); … etc } Unfortunately, give that the name of the hosting class is part of the logger declaration, the above logger declaration idiom is not is not resistant to cut-and-pasting between classes.
Related Questions
- Don buy optional/recommended books until you attend the first class. At that time, ask the instructor: • How is optional/recommended defined? • Is the optional/recommended material necessary to perform successfully in class?
- What type of roof deck protection is recommended for Class A fire protection?
- Is there a recommended idiom for declaring a logger in a class?