Logging in Spring boot is very simple and involves only a few steps. Here they are:
In each of your code files, add the following line at the beginning of the class:
private static final Logger LOGGER=LoggerFactory.getLogger(MyClass.class);
Now you can easily log anything that you want by adding this logger line:
LOGGER.info(“any logger message that you want”);
There are 5 logging levels available in the logger. They are:
You can use any of those by calling the respective methods. In earlier point, we have called the info method of the logger.
In your application.properties file…