This article is a mirror article of machine translation, please click here to jump to the original article.

View: 24383|Reply: 1

[Source] Log4Net logs to the SQLServer database

[Copy link]
Posted on 2/9/2017 5:28:26 PM | | |
Log4Net configuration steps:

1. Add a Log4Net reference to the project, which can be downloaded from the nuget package tool

2. Add the Log4Net.config file to the project and configure it

Note: Create a logging table in the database by referencing the configuration file [Log]. [SystemException]


3. Add the following configuration to the AssemblyInfo.cs file of the project




4. Rewrite the Log4Net service and create a singleton

5. Add the call method

If you need to automatically record system exception logs for MVC projects, you can refer to the following methods:

6. New features, which can be specified for a single Action, or registered as a global feature (all Actions)




7. Register the feature as a global feature in the Global.asax file of the project

In this way, MVC projects can automatically log data to the database.




Previous:How to add MIME types in your ASP.NET's web.config configuration file
Next:js beautifies json data
 Landlord| Posted on 2/9/2017 5:28:59 PM |
.net/c# log4net database configuration write log [with source code]
http://www.itsvse.com/thread-3478-1-1.html
(Source: Architect)
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com