标签:blog http io ar sp 文件 on art log
MDC与NDC除了存储方式(MDC采用MapNDC采用堆栈结构)有区别,其他都一样的
关键点
A
-//引入log4j MDC类org.apache.log4j.MDC
-//设置值
-MDC.put("fId", "safsdfsafasdCopyOflog4jServlet2"+index);
B
-配置log4j.porperties文件MDC取值格式
-log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %X{fId} -%m%n,注意是大写‘X‘
参考:
http://www.csd恩123.com/html/exception/679/679780_679781_679778.htm
http://blog.csdn.net/ziruobing/article/details/3919501
http://www.cnblogs.com/zyfxlv/archive/2012/09/02/log4j.html
http://blog.csdn.net/yangshuanbao/article/details/6804144
http://www.ibm.com/developerworks/cn/web/wa-lo-usertrack/index.html#Log4JSample
http://blog.csdn.net/huxin1/article/details/5736227
标签:blog http io ar sp 文件 on art log
原文地址:http://www.cnblogs.com/svennee/p/4063376.html