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

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Visual Studio Blog
IT之家
IT之家
博客园 - 聂微东
The Cloudflare Blog
月光博客
月光博客
阮一峰的网络日志
阮一峰的网络日志
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
H
Help Net Security
博客园 - 叶小钗
V
V2EX
WordPress大学
WordPress大学
J
Java Code Geeks
Hugging Face - Blog
Hugging Face - Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园_首页
C
Check Point Blog
B
Blog
D
DataBreaches.Net
美团技术团队
罗磊的独立博客

博客园 - 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然后再添加自己的。