log4net的ASP.NET中的唯一请求ID [英] log4net unique request id in ASP.NET
问题描述
log4net的1.2.11.0
log4net 1.2.11.0
我试图得到任何东西,让我登录为每个ASP.NET请求一个独特的价值。
I am trying to get anything that will allow me to log with a unique value for each ASP.NET request.
我试过%线程,但线程似乎被重用。
I tried %thread, but threads appear to be reused.
我已经试过这没有什么在其中有意义%ASPNET请求和%ASPNET会话。
I've tried %aspnet-request and %aspnet-session which don't have anything meaningful within them.
我看着ThreadContext.Properties和LogicalThreadContext.Properties但他们没有对他们有任何事。
I looked at ThreadContext.Properties and LogicalThreadContext.Properties but they don't have anything in them either.
任何人都有得到这个工作的把戏?我需要选择一个特定的请求的注销日志文件的能力。
Anyone have a trick to get this done? I need the ability to pick a particular request's logs out of the log file.
推荐答案
时钟滴答
+ 进程标识
+ 线程ID
作为存储时,你的要求开始应该是足够了,我觉得(假设每个线程处理在同一时间1要求)。
clock tick
+ process ID
+ thread ID
as stored when your request starts should be sufficient, I think (assuming each thread handles 1 request at a time).
这篇关于log4net的ASP.NET中的唯一请求ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!