开发者

Add a custom property to include in all log4net messages

开发者_JS百科

I have a unique identifier which goes through the whole application. I want this 'ID' to be logged as a separate property, so that it's easy to find out in log files or from the database.


You can use context properties e.g. like this:

ThreadContext.Properties["ID"] = yourID;

then you can access the property in the pattern string like this:

%property{ID}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜