Configuration method of specifying output file location based on Web Project Log

First, we define a webapprootkey that can dynamically find the path of the project at runtime. The reason for this is to configure the log4j output file path at will.

Then define the path of the project log configuration file and the log4j listener

So Web The XML file is configured, and then the specific configuration file of the log configuration file:

The project structure is as follows:

After everything is ready, once the project is started, you can find your daily or hourly log files in your specified output location. The log configuration file can also be expanded to configure the size of each file and rollback in case of file error, which will not be repeated here.

The above configuration method of specifying the output file location based on the web project log is all the content shared by Xiaobian. I hope it can give you a reference and support more programming tips.

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
分享
二维码
< <上一篇
下一篇>>