Article Directory
Configure log4j log in SpringBoot
All our sql is invisible now, we want to know how it is executed, so we have to look at the log!
1. Import dependencies
The import dependency is as follows:
If you do not perform the operation of excluding the logging package, the following error will be reported when starting:
2. Write log4j.properties file
Write the log4j.properties file in the resources static directory, as shown below:
3. Configure log4j logs in the application.yaml configuration file
In the configuration file, you need to tell the program what kind of log you are using, as shown below:
4. Test results
5. Expansion
If you do not use log4j logs but use logging logs, as shown below: