Skip to content

Instantly share code, notes, and snippets.

Created March 23, 2019 14:18
What would you like to do?
SLF4J logging example
package com.logging-example
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
public class LoggingController {
// declare the SLF4J logger
private Logger logger = LoggerFactory.getLogger(LoggingController.class);
public ResponseEntity<String> get() {
// log an info message"An info message");
return ResponseEntity.ok("Hello world");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment