当前位置:网站首页>. 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
边栏推荐
- Install bitgarden open source password manager
- Do you need a server to set up cloud on demand? What services can cloud on demand provide?
- Disaster recovery series (VII) -- hybrid cloud public network export disaster recovery construction
- After the collapse of UST, will the stable currency market pattern usher in new opportunities?
- Configure two databases in master-slave database mode (master and slave)
- Add two factor authentication, not afraid of password disclosure, let alone 123456
- Implementation of flashback query for PostgreSQL database compatible with Oracle Database
- JS naming conventions
- 【Golang】深究字符串——从byte rune string到Unicode与UTF-8
- GL Studio 5 installation and experience
猜你喜欢

35 year old crisis? It has become a synonym for programmers

FPGA based electromagnetic ultrasonic pulse compression detection system paper + source file

ZABBIX monitoring - Aruba AP operation data

After the collapse of UST, will the stable currency market pattern usher in new opportunities?

Technology sharing | wvp+zlmediakit realizes streaming playback of camera gb28181

JS advanced programming version 4: generator learning

JS高级程序设计第 4 版:生成器的学习

Rstudio 1.4 software installation package and installation tutorial

Ugeek's theory 𞓜 application and design of observable hyperfusion storage system

Tupu software digital twin intelligent water service, breaking through the development dilemma of sponge City
随机推荐
券商选哪个比较好尼?本人小白不懂,在线开户安全么?
Digital procurement transformation solution: SaaS procurement management platform promotes enterprise sunshine procurement
【Golang】使用Go语言操作etcd——配置中心
Easyplayer player error 502 bad gateway problem analysis
Can Tencent cloud disk service share data? What are the advantages of cloud disk service?
JS regular ignore case
How to handle the prompt that DNS is incorrect when adding resolution to Tencent cloud?
QPS fails to go up due to frequency limitation of public network CLB bandwidth
教你如何用网页开发APP
[golang] quick review guide quickreview (x) -- goroutine pool
Implementation of microblog system based on SSM
How do I view the server when I log in to the fortress machine? Operation guide for novice
@@Script implementation of ishell automatic deployment
What is the role of short video AI intelligent audit? Why do I need intelligent auditing?
【Golang】在Go语言的角度重新审视闭包
LeetCode 260. Number III that appears only once
Emmet syntax specification
How to build a cloud game platform? Disadvantages of traditional games
Postman tutorial - teach you API interface testing by hand
December 29, 2021: the elimination rules of a subsequence are as follows: 1. In a subsequence