C# Log4net 转换模式列表

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1102026/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 08:17:15  来源:igfitidea点击:

List of Log4net Conversion Patterns

c#.netlogginglog4net

提问by kay.one

Is there a comprehensive list of all the conversion patterns available for log4net? I can't even find them in the source code.

是否有可用于 log4net 的所有转换模式的完整列表?我什至无法在源代码中找到它们。

All I have found is this; shouldn't there be more patterns? For example, how would I get the name of the hosting application?

我所发现的就是这个;不应该有更多的模式吗?例如,我将如何获得托管应用程序的名称?

Also, how can I add my own patterns?

另外,如何添加我自己的模式?

As an example here is the comparable list but for nlog.

作为示例,这里是可比列表,但用于nlog

Edit:I have found the Pattern for application name; it's [Application]. But I'm still looking for the mother-load. Can someone at least point me to the class in the source that manages these? Maybe I could find the list from that.

编辑:我找到了应用程序名称的模式;它是[Application]。但我仍在寻找母亲的负担。有人至少可以将我指向管理这些的源代码中的类吗?也许我可以从中找到清单。

回答by si618

As far as the official list of patterns go, I think you found it! :)

至于官方的模式列表,我想你找到了!:)

As far as getting name of hosting application, isn't that the appdomainconversion pattern name? Not sure why it's needed as the AppDomain.ToString()overload returns application friendly name in the apattern...ahh...hang on, ToString() also includes context policies, and they are probably extra noise in this context.

至于获取托管应用程序的名称,那不是应用程序转换模式名称吗?不知道为什么需要它,因为AppDomain.ToString()重载以a模式返回应用程序友好名称......啊......等等,ToString() 还包括上下文策略,在这种情况下它们可能是额外的噪音。

As far as adding your own patterns, 10 seconds with Google returned this link.

至于添加你自己的模式,谷歌10秒返回了这个链接

回答by SpoiledTechie.com

Looks like that link is Dead.

看起来那个链接已经死了。

I found it in the Waybacktimemachine and posted it to my blog.

我在 Waybacktimemachine 中找到了它并将其发布到我的博客上。

http://spoiledtechie.com/post/2015/11/19/Conversion-Patterns-for-Log4Net.aspx

http://spoiledtechie.com/post/2015/11/19/Conversion-Patterns-for-Log4Net.aspx

It might be too much to post here on SO. If I am wrong, I will happily post here if everyone agrees that its not too bad.

在 SO 上发帖可能太多了。如果我错了,如果每个人都同意这还不错,我会很乐意在这里发帖。

回答by Rae

The Remarkssection of the log4net.Layout.PatternLayoutclass in the Apache Log4Net SDK documentation looks to have what we want:

Apache Log4Net SDK 文档中类的备注部分log4net.Layout.PatternLayout看起来有我们想要的:

http://logging.apache.org/log4net/release/sdk/?topic=html/T_log4net_Layout_PatternLayout.htm

http://logging.apache.org/log4net/release/sdk/?topic=html/T_log4net_Layout_PatternLayout.htm