For our previous set of operations, the logs were all on the console.
But if your project is running in the formal environment and the operation and maintenance personnel suddenly tell you that the log error is reported, but your logs are only on the console, what if the company's project If the number of visits is very large, it will be difficult for you to find a certain log on the console.
At this time we can use a file to write it down.
We open the project and find the configuration file. Here I use application.yml.
We only need to add the code in it.
logging:
file:
name: serve.log
That's fine.
Then we start the project directly.
Here you can see our log file. When
we open it, we can see the content.
Here I adjust the interface to let him take the log.
Here our console log is output.
We
can look at the log file again. After seeing our content, we went up.
In fact, it is really not necessary to set the log format, because many people say that if you open it directly in local++ or notepad, there is no color difference at all,
so there is really no setting when setting up the log. Anyway, the color is used as a notepad for others to see, mainly so that problems can be found through the logs.