惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
H
Help Net Security
量子位
The Cloudflare Blog
博客园 - Franky
博客园 - 聂微东
博客园 - 司徒正美
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
宝玉的分享
宝玉的分享
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
罗磊的独立博客
GbyAI
GbyAI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
美团技术团队
阮一峰的网络日志
阮一峰的网络日志
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
MongoDB | Blog
MongoDB | Blog

博客园 - Amonw's Weblog

.NET默认一个客户端对同一个服务器地址同时只能建立2个TCP连接 homekit2mqtt on DietPi Oracle 12c client with .NET legacy Oracle driver Minimum setup for Apache+AD SSO Minimum configuration for openldap to proxy multiple AD into a single search base 排列组合算法(PHP) Make Notepad++ auto close HTML/XML tags after the slash(the Dreamweaver way) ASDM through site to site VPN - Amonw's Weblog PHP, LDAPS and Apache DFS security warning and use group policy to set up internet security zones Refresh recovery area usage data after manually deleting files under recovery area Create Oracle Enterprise Manager repository data after restore a database from another server Restore Oracle database to another server .PRT extension and multiple NX versions Fix network adapter not present problem in cloned CentOS NX 8.5 License Server Firewall Setting Cisco ASA intra-interface routing How to configure windows machine to allow file sharing with dns alias (CNAME) Install unifi controller on CentOS
.Net Trace->Listeners->Remove
Amonw's Weblog · 2017-05-04 · via 博客园 - Amonw's Weblog

今天在调试一个别人写的ASP.NET老程序,log文件怎么都写不了。web.config里的trace->listeners里有这么一行:

<remove type="System.Diagnostics.DefaultTraceListener"/>

注释掉就好了。google了一下,很多例子都是这样写的,甚至MSDN上也有这样的例子:

https://msdn.microsoft.com/en-us/library/system.diagnostics.defaulttracelistener(v=vs.71).aspx

不过这些例子都是很多年前的了。查MS关于remove的文档:

https://msdn.microsoft.com/en-us/library/w11c2b46(v=vs.110).aspx

remove的参数应该是name而不是type。把上面那行改成:

<remove name="Default" />

就好了。

或者也可以在listeners的第一行用

<clear/>

清掉所有的listener然后再添加自己的。