当前位置:网站首页>. Net Core 3. X MVC built-in log extension log4net
. Net Core 3. X MVC built-in log extension log4net
2022-06-23 20:49:00 【conanma】
Core Built in logs
It can be downloaded from Home controller There are several lines of log code in the code , This is it. Dependency injection , It will be used a lot later .
And then Index Method to add code
_logger.LogInformation(" The home page has been visited ");
You can see that the console directly outputs information
Next use log4net Let's expand
First, refer to the relevant package
Dependency right click -> management NuGet Package -> Browse -> The following package name -> Choose spot install
log4net.AspNetCore
Microsoft.extensions.logging.log4net.aspnetcore
I'm going to modify Program.cs
add to log4net The configuration file
Be careful :log4net.config Right click -> attribute Always copy
So we're done Log expanded , Run to see the effect
You can see bin There is more than one in the catalog log Folder and inside log.txt
See that the information just now is output to the log
边栏推荐
- GL Studio 5 installation and experience
- Is Guoyuan futures trading software formal? How to download safely?
- How to build a personal cloud game server? How many games can the cloud game platform install?
- What is the difference between a database and a cloud disk drive? What functions can cloud disk drives achieve?
- JS delete object attribute
- Configure two databases in master-slave database mode (master and slave)
- Advantages of token mechanism over cookie mechanism
- Kinsoku Jikou Desu Sina stock interface change
- Is Huishang futures trading software formal? How to download safely?
- 数字化采购转型解决方案:SaaS采购管理平台推进企业阳光采购
猜你喜欢

Importance and purpose of test

Daily question brushing record (II)

The "open source star picking program" container pulls private images from harbor, which is a necessary skill for cloud native advanced technology
Implementing MySQL fuzzy search with node and express

Yaokui tower in Fengjie, Chongqing, after its completion, will be the safety tower for Sichuan river shipping with five local scholars in the company

GL Studio 5 installation and experience

ZABBIX monitoring - Aruba AP operation data

Tupu software digital twin intelligent water service, breaking through the development dilemma of sponge City

Use of the vs2022scanf function. An error is reported when using scanf - the return value is ignored: Solutions

Kubernetes resource topology aware scheduling optimization
随机推荐
Script tag attributes and & lt; noscript> label
Rstudio 1.4 software installation package and installation tutorial
ntpupdate. tencentyun. Com has been eliminated
How do I open an account? Is it safe to open an account in Guohai Securities? What do you need to bring?
How to deal with unclear pictures? How to deal with color balance?
[golang] quick review guide quickreview (VII) -- Interface
重庆 奉节耀奎塔,建成后当地连中五名进士,是川江航运的安全塔
想开个户,在股票网上开户安全吗?资金会被骗走吗?
How PostgreSQL quickly locate blocking SQL
Excel text function
ZABBIX monitoring - Aruba AP operation data
Is Guoyuan futures trading software formal? How to download safely?
教你如何用网页开发桌面应用
How to solve the problem that the ID is not displayed when easycvr edits the national standard channel?
@@Script implementation of ishell automatic deployment
Want to open an account, is it safe to open an account on the stock Internet? Will the funds be cheated away?
How to make a material identification sheet
【Golang】快速复习指南QuickReview(四)——函数
35 year old crisis? It has become a synonym for programmers
LeetCode 260. Number III that appears only once