Lombok related code changes (#7326)
This commit is contained in:
parent
7eaa85d524
commit
a057974b11
@ -34,6 +34,12 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-log4j2</artifactId>
|
<artifactId>spring-boot-starter-log4j2</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.4</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- for Graylog demo -->
|
<!-- for Graylog demo -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -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...";
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user