Lombok related code changes (#7326)

This commit is contained in:
nikunjgandhi1987 2019-07-20 23:26:37 -04:00 committed by Josh Cummings
parent 7eaa85d524
commit a057974b11
2 changed files with 34 additions and 0 deletions

View File

@ -34,6 +34,12 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
<!-- for Graylog demo -->
<dependency>

View File

@ -0,0 +1,28 @@
package com.baeldung.springbootlogging;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import lombok.extern.slf4j.Slf4j;
//import lombok.extern.log4j.Log4j2;
//import lombok.extern.apachecommons.CommonsLog;
@RestController("LombokLoggingController")
@Slf4j
// @CommonsLog (Comment any other Lombok logging annotation and uncomment this
// to work with Apache Commons Logging)
// @Log4j2 (Comment any other Lombok logging annotation and uncomment this to
// work directly with Log4j2)
public class LombokLoggingController {
@GetMapping("/lombok")
public String index() {
log.trace("A TRACE Message");
log.debug("A DEBUG Message");
log.info("An INFO Message");
log.warn("A WARN Message");
log.error("An ERROR Message");
return "Howdy! Check out the Logs to see the output...";
}
}