diff options
-rw-r--r-- | src/core/lombok/eclipse/handlers/HandleLog.java | 2 | ||||
-rw-r--r-- | src/core/lombok/extern/log4j/Log4j.java | 4 | ||||
-rw-r--r-- | src/core/lombok/javac/handlers/HandleLog.java | 2 | ||||
-rw-r--r-- | test/transform/resource/after-delombok/LoggerLog4j.java | 4 | ||||
-rw-r--r-- | test/transform/resource/after-ecj/LoggerLog4j.java | 8 | ||||
-rw-r--r-- | test/transform/resource/before/LoggerLog4j.java | 4 |
6 files changed, 22 insertions, 2 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleLog.java b/src/core/lombok/eclipse/handlers/HandleLog.java index 891d4df2..1cd933e3 100644 --- a/src/core/lombok/eclipse/handlers/HandleLog.java +++ b/src/core/lombok/eclipse/handlers/HandleLog.java @@ -181,7 +181,7 @@ public class HandleLog { @ProviderFor(EclipseAnnotationHandler.class) public static class HandleLog4jLog extends EclipseAnnotationHandler<lombok.extern.log4j.Log4j> { @Override public void handle(AnnotationValues<lombok.extern.log4j.Log4j> annotation, Annotation source, EclipseNode annotationNode) { - processAnnotation(LoggingFramework.LOG4J, annotation, source, annotationNode, ""); + processAnnotation(LoggingFramework.LOG4J, annotation, source, annotationNode, annotation.getInstance().value()); } } diff --git a/src/core/lombok/extern/log4j/Log4j.java b/src/core/lombok/extern/log4j/Log4j.java index 29e1b27c..0fe74599 100644 --- a/src/core/lombok/extern/log4j/Log4j.java +++ b/src/core/lombok/extern/log4j/Log4j.java @@ -59,4 +59,8 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.SOURCE) @Target(ElementType.TYPE) public @interface Log4j { + /** + * Sets the category of the constructed Logger. By default, it will use the type where the annotation is placed. + */ + String value() default ""; }
\ No newline at end of file diff --git a/src/core/lombok/javac/handlers/HandleLog.java b/src/core/lombok/javac/handlers/HandleLog.java index bdb80ccb..b01dd564 100644 --- a/src/core/lombok/javac/handlers/HandleLog.java +++ b/src/core/lombok/javac/handlers/HandleLog.java @@ -131,7 +131,7 @@ public class HandleLog { @ProviderFor(JavacAnnotationHandler.class) public static class HandleLog4jLog extends JavacAnnotationHandler<lombok.extern.log4j.Log4j> { @Override public void handle(AnnotationValues<lombok.extern.log4j.Log4j> annotation, JCAnnotation ast, JavacNode annotationNode) { - processAnnotation(LoggingFramework.LOG4J, annotation, annotationNode, ""); + processAnnotation(LoggingFramework.LOG4J, annotation, annotationNode, annotation.getInstance().value()); } } diff --git a/test/transform/resource/after-delombok/LoggerLog4j.java b/test/transform/resource/after-delombok/LoggerLog4j.java index 7d54b259..99eac34f 100644 --- a/test/transform/resource/after-delombok/LoggerLog4j.java +++ b/test/transform/resource/after-delombok/LoggerLog4j.java @@ -5,4 +5,8 @@ class LoggerLog4j { class LoggerLog4jWithImport { @java.lang.SuppressWarnings("all") private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(LoggerLog4jWithImport.class); +} +class LoggerLog4jWithDifferentName { + @java.lang.SuppressWarnings("all") + private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger("DifferentName"); }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/LoggerLog4j.java b/test/transform/resource/after-ecj/LoggerLog4j.java index 6814be7b..a6c52d61 100644 --- a/test/transform/resource/after-ecj/LoggerLog4j.java +++ b/test/transform/resource/after-ecj/LoggerLog4j.java @@ -14,4 +14,12 @@ import lombok.extern.log4j.Log4j; LoggerLog4jWithImport() { super(); } +} +@Log4j("DifferentName") class LoggerLog4jWithDifferentName { + private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger("DifferentName"); + <clinit>() { + } + LoggerLog4jWithDifferentName() { + super(); + } }
\ No newline at end of file diff --git a/test/transform/resource/before/LoggerLog4j.java b/test/transform/resource/before/LoggerLog4j.java index 03735bff..fa7dad4a 100644 --- a/test/transform/resource/before/LoggerLog4j.java +++ b/test/transform/resource/before/LoggerLog4j.java @@ -6,4 +6,8 @@ class LoggerLog4j { @Log4j class LoggerLog4jWithImport { +} + +@Log4j("DifferentName") +class LoggerLog4jWithDifferentName { }
\ No newline at end of file |