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

推荐订阅源

Cisco Talos Blog
Cisco Talos Blog
阮一峰的网络日志
阮一峰的网络日志
云风的 BLOG
云风的 BLOG
D
Docker
Vercel News
Vercel News
IT之家
IT之家
Recent Announcements
Recent Announcements
Last Week in AI
Last Week in AI
V
Visual Studio Blog
Engineering at Meta
Engineering at Meta
腾讯CDC
Google DeepMind News
Google DeepMind News
I
InfoQ
博客园 - 三生石上(FineUI控件)
Apple Machine Learning Research
Apple Machine Learning Research
The GitHub Blog
The GitHub Blog
博客园 - Franky
The Cloudflare Blog
A
About on SuperTechFans
有赞技术团队
有赞技术团队
Y
Y Combinator Blog
T
Tenable Blog
P
Proofpoint News Feed
Recorded Future
Recorded Future
Security Latest
Security Latest
H
Hackread – Cybersecurity News, Data Breaches, AI and More
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - 聂微东
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Google Online Security Blog
Google Online Security Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Simon Willison's Weblog
Simon Willison's Weblog
The Last Watchdog
The Last Watchdog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
News and Events Feed by Topic
TaoSecurity Blog
TaoSecurity Blog
U
Unit 42
The Hacker News
The Hacker News
Martin Fowler
Martin Fowler
T
Threat Research - Cisco Blogs
NISL@THU
NISL@THU
F
Full Disclosure
M
MIT News - Artificial intelligence
人人都是产品经理
人人都是产品经理
Hugging Face - Blog
Hugging Face - Blog
V
V2EX
Project Zero
Project Zero

博客园 - somesongs

好多年没回到这个园子 有趣的多媒体 发布简短计划,备忘 Intelligencia.UrlRewriter, 解决404找不到文件的问题 forms验证如此简单 在一个页面中调用另一个页面定义的函数 .net中,数据提交完毕后,刷新绑定控件,清空输入框的好办法,就是在时间函数的最后加入Response.Redirect(Request.FilePath); Flash的全屏播放(转) flash中实现拖拽 Treeview中,递归生成从当前选中节点到根节点的全路径 .net从后台返回js的提示框 编写xmlhelper类【翻译】 [转]C#网络编程概述 【转】C#网络编程初探 只需一行代码实现增删查改,微软已经让我们很简单。谈AccessDataSource的使用。 document.body.clientHeight与document.documentElement.clientHeight 动态将Js代码写入到Head标签中 Asp.net中删除前的提示信息 location和history的详细设置
[转] Trace跟踪输出进行调试
somesongs · 2009-02-16 · via 博客园 - somesongs

(一).说明
     很多人在调试输入时,一般用: Respone.Write(),或跟踪后再在命令窗口计算对象的值等方法.
     其实Microsoft为Asp.net提供很好的输出调试类Trace.  这里讲一下它的用法
(二)具体用法

  分为页面级别调试和应用程序级别跟踪调试:
     1.页级别跟踪: 在页的开头包括如下的页指令<%@ Page Trace="True"   TraceMode="SortByCategory/SortByTime" %>
       I.自定义消息示例: 
         Trace.Write("这里为要输出结果的变量或自定义字符串"); 
         Trace.Warn("这里为要显示的字符串");   //与Trace.Write相同,只是字体为红色
                检查是否使用了跟踪
       
       II.判断是否启用了跟踪输出:        
          if(Trace.IsEnabled) { Trace.Warn("已启用跟踪")} 


     2.应用程序级别跟踪: 
       在Web.config文件的<System.Web>节中 <trace enabled="true" pageOutput="true"/> 
       这样就不用在一个一个页面中设置了.


用Trace跟踪调试最大的好处是:  程序员用完后只要将 页面或应用程序跟踪设为:false即可.

不用将其删除或注释. 因为编译器编译到Trace输出
语句时,不会将其编译,会略过Trace语句继续编译下面的语句。 

 从程序员角度看,即Trace相当于已经注释掉了