开发者

Log4net getting properties(name-value pairs) from config files for Custom Appender

开发者 https://www.devze.com 2023-03-26 12:14 出处:网络
Is there a way to get the config properties in LOG4NET without defining a property for each name-value property. I am just curious to know if there is a开发者_如何学编程ny method which could return di

Is there a way to get the config properties in LOG4NET without defining a property for each name-value property. I am just curious to know if there is a开发者_如何学编程ny method which could return dictionary of config properties?


I do not see how to achieve this: Log4net parses the configuration file and the sets the properties of the appenders. The appender never gets hold of the configuration.

If you are willing to change log4net you could change this behavior: Build a dictionary while parsing the configuration and call a method on the appender that accepts this dictionary.... but unless you need dynamic options this is probably not worth the effort.

0

精彩评论

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