aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/lombok/eclipse/handlers/HandleLog.java2
-rw-r--r--src/core/lombok/extern/java/Log.java4
-rw-r--r--src/core/lombok/javac/handlers/HandleLog.java2
-rw-r--r--test/transform/resource/after-delombok/LoggerJul.java4
-rw-r--r--test/transform/resource/after-ecj/LoggerJul.java8
-rw-r--r--test/transform/resource/before/LoggerJul.java4
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 0f77bf76..891d4df2 100644
--- a/src/core/lombok/eclipse/handlers/HandleLog.java
+++ b/src/core/lombok/eclipse/handlers/HandleLog.java
@@ -171,7 +171,7 @@ public class HandleLog {
@ProviderFor(EclipseAnnotationHandler.class)
public static class HandleJulLog extends EclipseAnnotationHandler<lombok.extern.java.Log> {
@Override public void handle(AnnotationValues<lombok.extern.java.Log> annotation, Annotation source, EclipseNode annotationNode) {
- processAnnotation(LoggingFramework.JUL, annotation, source, annotationNode, "");
+ processAnnotation(LoggingFramework.JUL, annotation, source, annotationNode, annotation.getInstance().value());
}
}
diff --git a/src/core/lombok/extern/java/Log.java b/src/core/lombok/extern/java/Log.java
index 7ae4e07b..dfa2e2aa 100644
--- a/src/core/lombok/extern/java/Log.java
+++ b/src/core/lombok/extern/java/Log.java
@@ -58,4 +58,8 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
public @interface Log {
+ /**
+ * 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 2ad16b80..bdb80ccb 100644
--- a/src/core/lombok/javac/handlers/HandleLog.java
+++ b/src/core/lombok/javac/handlers/HandleLog.java
@@ -121,7 +121,7 @@ public class HandleLog {
@ProviderFor(JavacAnnotationHandler.class)
public static class HandleJulLog extends JavacAnnotationHandler<lombok.extern.java.Log> {
@Override public void handle(AnnotationValues<lombok.extern.java.Log> annotation, JCAnnotation ast, JavacNode annotationNode) {
- processAnnotation(LoggingFramework.JUL, annotation, annotationNode, "");
+ processAnnotation(LoggingFramework.JUL, annotation, annotationNode, annotation.getInstance().value());
}
}
diff --git a/test/transform/resource/after-delombok/LoggerJul.java b/test/transform/resource/after-delombok/LoggerJul.java
index 20f0d24d..ad119777 100644
--- a/test/transform/resource/after-delombok/LoggerJul.java
+++ b/test/transform/resource/after-delombok/LoggerJul.java
@@ -5,4 +5,8 @@ class LoggerJul {
class LoggerJulWithImport {
@java.lang.SuppressWarnings("all")
private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(LoggerJulWithImport.class.getName());
+}
+class LoggerJulWithDifferentName {
+ @java.lang.SuppressWarnings("all")
+ private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger("DifferentName");
} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/LoggerJul.java b/test/transform/resource/after-ecj/LoggerJul.java
index c98dfe27..3aa8181d 100644
--- a/test/transform/resource/after-ecj/LoggerJul.java
+++ b/test/transform/resource/after-ecj/LoggerJul.java
@@ -14,4 +14,12 @@ import lombok.extern.java.Log;
LoggerJulWithImport() {
super();
}
+}
+@Log("DifferentName") class LoggerJulWithDifferentName {
+ private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger("DifferentName");
+ <clinit>() {
+ }
+ LoggerJulWithDifferentName() {
+ super();
+ }
} \ No newline at end of file
diff --git a/test/transform/resource/before/LoggerJul.java b/test/transform/resource/before/LoggerJul.java
index 52869e81..41e36220 100644
--- a/test/transform/resource/before/LoggerJul.java
+++ b/test/transform/resource/before/LoggerJul.java
@@ -6,4 +6,8 @@ class LoggerJul {
@Log
class LoggerJulWithImport {
+}
+
+@Log("DifferentName")
+class LoggerJulWithDifferentName {
} \ No newline at end of file