引言: 7. Nested Diagnostic Contexts在现实世界中的系统经常不得不同时处理多个客户端请求。
摘要:在论坛看到这个帖子,觉得有意思,就实现了一下。其实这个问题以前的高人写了文章的。好像是net_lover吧,记的不是很清楚。 代码如下: using system;using system.windows.forms;class test{ form frm = new form(); button btnok = new button(); textbox txtpsw = new textbox(); static void main(string [......
摘要:python是一种面向对象的解释性语言.它是一种高级编程语言,也就是说它尽可能将用户与底层操作系统隔离.然而,与其他解释性语言不同的是支持对操作系统的底层访问.因而,通常将划分在处于vb或perl到系统级的c语言之间的位置. 虽然象perl,tcl和其他一些语言一样,python被认为是一种解释性语言,但是它有编译的过程,用编码器将原始的脚本翻译成一系列字节码,然后让字节码在python虚拟机上面跑.但是由于是脚本语言,所以和c以及pascal这类编译语言......
Log4j简明手册(3/3)7. nested diagnostic contexts 【相关文章:
[J2SE 1.5]逐渐挖掘Autobo】 【扩展阅读:
[J2SE 1.5]逐渐挖掘Enhanc】在现实世界中的系统经常不得不同时处理多个客户端请求。在这样的一个典型的多线程的系统中,不同的线程将处理不同的客户端。logging特别能够适应这种复杂的分布式的应用程序的调试与跟踪。一个常见的区分每个客户端所输出的logging的方法是为每个客户端实例化一个新的独立的logger。这导致logger的大量产生,管理的成本也超过了logging本身。 【扩展信息:
C++小花园】 唯一标识每个log请求是一个轻量级的技术。neil harrison 在名为“patterns for logging diagnostic messages”的书中描述了这个方法in pattern languages of program design 3, edited by r. martin, d. riehle, and f. buschmann (addison-wesley, 1997). 为了唯一标识每个请求,用户把上下文信息推入ndc(nested diagnostic context)中。 ndc类示例如下: public class ndc { // used when printing the diagnostic public static string get(); // remove the top of the context from the ndc. public static string pop(); // add diagnostic context for the current thread. public static void push(string message); // remove the diagnostic context for this thread. public static void remove(); } ndc如同一个堆栈样管理每个线程。注意所有the org.apache.log4j.ndc 类的方法都是静态的。假设ndc输出被开启,每次一个log 请求被生成时,适当的log4j组件为将要输出log的线程包含完整的ndc堆栈。这是在没有用户的干预的情况下做到的,用户只负责在ndc中定位正确的信息,通过在代码中正确位置插入很少的push与pop方法就行了。相反的,在代码中per-client实现方法有着很大变化。 为了演示这个点,让我们以一个发送内容到匿名客户端的servlet为例。...
下一页 摘要: 好久以前作的东西,最近拿出来溜溜,最近一直没有作应用程序方面的东西了,有点生疏! 希望我的这篇东西能对您有所帮助,大家共同探讨共同进步,此文章比较简单!是作一个通用的登陆框控件! 首先建一解决项目logincontrol,添加一个类库的项目logincontrol,然后添加用户控件ctllogin 然后在ctllogin.cs文件中写代码 //ctllogin.cs using system;using system.collections;using ......