List of Log4net Conversion Patterns

2020-05-23 01:59发布

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

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.

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.

3条回答
贼婆χ
2楼-- · 2020-05-23 02:12

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 appdomain conversion pattern name? Not sure why it's needed as the AppDomain.ToString() overload returns application friendly name in the a pattern...ahh...hang on, ToString() also includes context policies, and they are probably extra noise in this context.

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

查看更多
The star\"
3楼-- · 2020-05-23 02:14

The Remarks section of the log4net.Layout.PatternLayout class in the Apache Log4Net SDK documentation looks to have what we want:

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

查看更多
做自己的国王
4楼-- · 2020-05-23 02:16

Looks like that link is Dead.

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

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.

查看更多
登录 后发表回答