Open himnay opened 3 years ago
I am having this issue in intelliJ 2021.2.3
The config is wrong, you have to use (TYPE,TOPIC)
instead of (TYPE)(TOPIC)
Probably the documentation at https://projectlombok.org/features/log could need some clarification/examples. I remember it being more a try and error, when I was using it.
Should I try to get my head around it and provide a PR with some more explanation for @CustomLog
? Might be a good topic for a first contribution.
I'm wrong, the code should work and generate private static final com.xxx.yyy.zzz.core.logging.Logger log = com.xxx.yyy.zzz.core.logging.LoggerFactory.getLogger(TestCustomLog.class);
. This works in my test.
@dstango It would be very great if you improved Lombok documentation. It’s barely useful the way it is now.
I am using below setup in build.gradle. dependencies { classpath 'io.freefair.gradle:lombok-plugin:2.9.5' }
lombok { config['lombok.log.custom.declaration'] = 'com.xxx.yyy.zzz.core.logging.Logger com.xxx.yyy.zzz.core.logging.LoggerFactory.getLogger(TYPE)(TOPIC)' }
dependencies { annotationProcessor 'org.projectlombok:lombok:1.18.20' implementation group: 'org.projectlombok', name: 'lombok', version: '1.18.20' }
I could see the below entries on the autogenerated lombok.config file
This file is generated by the 'io.freefair.lombok' Gradle plugin
config.stopBubbling = true lombok.addLombokGeneratedAnnotation = true lombok.log.custom.declaration = com.xxx.yyy.zzz.core.logging.Logger com.xxx.yyy.zzz.core.logging.LoggerFactory.getLogger(TYPE)(TOPIC)
My Sample Code
import lombok.CustomLog;
@CustomLog public class TestCustomLog { public void test() { log.info("Hello World"); } }
Exception: error: cannot find symbol log.info("Hello World"); ^ symbol: variable log location: class TestCustomLog
IDE Ver: INTELLIJ ULIMATE 2020.3 JDK Ver: 8
There are other lombok annotation which I have used and they work fine.
xxx.yyy.zzz - this is the package to our in-house logging framework.