I am writing a log4net Appender and this appender needs the object of the framework of the app initializing log4net. This framework implements a specific interface. While XmlConfigurator.Configure() is called by this framework, there is no way to pass an object down from Configure() and there is no way to walk up the call stack to get the this object at each call.
There is also no way, as far as I can tell, to get a list of all top level objects. (Point of fact, I'm not sure that .NET even has the concept of "top level" objects.) So no way to walk a set of objects finding the one that implements the interface AFAIK.
The best I've come up with is a static MyAppender.SetFramework(frameworkObject) call to be made before XmlConfigurator.Configure(). And I dislike this as it's an ugly hack.
So, any suggestions for a better solution?
Aucun commentaire:
Enregistrer un commentaire