Spring boot log introduction
The dependencies of the jar package in spring boot are as follows; during
actual development, we don’t need to import the log jar package in the maven project. There is a log jar package in the jar package that spring boot starts.
SpringBoot uses slf4j logs (I just try this)
Step 1: Create a spring boot project
Step 2: Test the default log level of spring boot in the unit test
To quote the log in this way, the current class
Logger passed in the brackets behind it is the current class Logger logger = LoggerFactory.getLogger(TestHashMapCompare.class);
Write a unit test, write 5 log output levels, from low to high.
Look carefully at the log output, the default log level of spring boot is INFO
Step 3: Set the log output level of spring boot
So how do we set the log output level of spring boot? It is very simple
in spring boot. This configuration can be
done in the application.properties file. Com.atguigu is the log output level under the specified package.
Look at the console as follows, the configuration is successful
Step 4: Configure the log path
Writing this way is to configure it under the current project.
If it is written in the form of D:/*.log, it means outputting to this directory.
As shown in the figure below, the log generates the
output format and other parameters of the log, and there will be time to add it later