1

I am trying to implement @Slf4j with log4j. I have done the below code but I am not getting the log variable in class.getting compilation error. Could anybody tell me what things I am missing here.

Plugin are already present in eclipse for Annotation Processors

Maven dependency

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.5</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.12.4</version>
<scope>provided</scope>
</dependency>


import lombok.extern.slf4j.Slf4j
@Slf4j
public class Main {
public static void main(String[] args) {
log.debug("Main Class");
}
}
ashishl
  • 201
  • 5
  • 12
  • 1
    You need to install Lombok by [executing `lombok.jar`](http://stackoverflow.com/questions/3418865/cannot-make-project-lombok-work-on-eclipse-helios/3425327#3425327). – Roel Spilker Sep 05 '16 at 09:59
  • Have already added but no luck :( – ashishl Sep 05 '16 at 14:31
  • Even I am able to add and supposed this worked for me but what will happen when the code will deploy on production – ashishl Sep 05 '16 at 15:05
  • If you compile using maven, and that works, you have no problems in production, since lombok is a compile time only dependency and does not require a runbtime. – Roel Spilker Sep 06 '16 at 07:39

0 Answers0