org.codenarc.rule.logging
[Groovy] Class LoggerForDifferentClassRule
java.lang.Object
org.codenarc.rule.AbstractRule
org.codenarc.rule.AbstractAstVisitorRule
org.codenarc.rule.logging.LoggerForDifferentClassRule
class LoggerForDifferentClassRule
extends AbstractAstVisitorRule
Rule that checks for instantiating a logger for a class other than the current class. Supports logger
instantiations for Log4J, Logback, SLF4J, Apache Commons Logging, Java Logging API (java.util.logging).
Limitations:
- Only checks Loggers instantiated within a class field or property (not variables or expressions within a method)
- For Log4J: Does not catch Logger instantiations if you specify the full package name for the Logger class:
e.g. org.apache.log4.Logger.getLogger(..)
- For SLF4J and Logback: Does not catch Log instantiations if you specify the full package name for the LoggerFactory
class: e.g. org.slf4j.LoggerFactory.getLogger(..)
- For Commons Logging: Does not catch Log instantiations if you specify the full package name for the LogFactory
class: e.g. org.apache.commons.logging.LogFactory.getLog(..)
- For Java Logging API: Does not catch Logger instantiations if you specify the full package name for the Logger
class: e.g. java.util.logging.Logger.getLogger(..)
- Authors:
- Chris Mair
- Version:
- \$Revision: 609 \$ - \$Date: 2011-02-24 13:48:43 -0500 (Thu, 24 Feb 2011) \$
Methods inherited from class AbstractRule
|
applyTo, applyTo, createViolation, createViolation, createViolationForImport, createViolationForImport, getImportsSortedByLineNumber, getName, getPriority, isReady, packageNameForImport, setName, setPriority, sourceLineAndNumberForImport, sourceLineAndNumberForImport, toString, validate |
astVisitorClass
Class astVisitorClass
-
name
String name
-
priority
int priority
-
Groovy Documentation