Configuration details of log4j logs in SSM consolidation

I have searched many log configuration methods on the Internet. Of course, there are many results, but none of them is what I want. I can't help but try it myself. Just how to introduce log4j into the project to display the log output. Of course, configuration files are indispensable.

Configure log4j properties

In the project of SSM integration, there will be a folder Src / main / resources

All resource-based files should be placed under this resource (personal habits can also be placed where they are allowed)

As for the specific content explanation in the log, there are many on the Internet. I won't tell them one by one.

The next step is to map Maven dependencies

Introduce Maven dependency in POM In XML

On the web Add the following to XML:

Log4jconfiglistener listener, which is used to listen to log startup:

that will do

After the above configurations are completed, you can run the project to try.

Results of log run

remarks

Spring elements appear in my project directory because I have installed the spring tool plug-in, which is a very good plug-in. Especially useful when writing configuration files. There are a lot of information on the Internet.

reference: https://www.oudahe.com/p/36247/

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>