[ 
https://issues.apache.org/jira/browse/LOG4NET-565?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16019915#comment-16019915
 ] 

Hitesh Chauhan edited comment on LOG4NET-565 at 5/22/17 6:20 PM:
-----------------------------------------------------------------

To me, this is similar to what core does for IAppender using reflection. The 
only thing it's doing is pushing IAppender instantiation one level down. Which 
opens up the more flexibilities for resolving any Appender types using IoC. 
Since all appenders implement IAppender so this code should not cause any 
issues or coupling between types. At least, I don't see that based on my 
understanding of log4net code - I am not an expert as I didn't write feature or 
fix any issues before.

If I understood correctly you are saying create a new custom appender 
"AppenderServiceLocatorAppender". I cannot image how it would solve the 
problem. The actual instance creating happens inside XmlHierarchyConfigurator 
class. so even if I create a new appender I would land into the same situation 
where I started.

"Further it would reduce the service locator api to something that does not 
contain an appender type. That makes this kind of a hack."
Apologies, I cannot visualize that. Are you saying no service locator api or 
use service locator but outside of the core? can you please help me to 
understand with the pseudo code?




was (Author: techminder):
To me, this is similar to what core does for IAppender using reflection. The 
only thing it's doing is pushing IAppender instantiation one level down. Which 
opens up the more flexibilities for resolving any Appender types using IoC. 
Since all appenders implement IAppender so this code should cause any issues or 
coupling between types. At least, I don't see that based on my understanding of 
log4net code - I am not an expert as I didn't write feature or fix any issues 
before.

If I understood correctly you are saying create a new custom appender 
"AppenderServiceLocatorAppender". I cannot image how it would solve the 
problem. The actual instance creating happens inside XmlHierarchyConfigurator 
class. so even if I create a new appender I would land into the same situation 
where I started.

"Further it would reduce the service locator api to something that does not 
contain an appender type. That makes this kind of a hack."
Apologies, I cannot visualize that. Are you saying no service locator api or 
use service locator but outside of the core? can you please help me to 
understand with the pseudo code?



> Dependency Injection support appender and logger types
> ------------------------------------------------------
>
>                 Key: LOG4NET-565
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-565
>             Project: Log4net
>          Issue Type: Improvement
>          Components: Appenders, Core
>            Reporter: Hitesh Chauhan
>              Labels: Enhancement
>
> I have seen demand for dependency injection support in log4net. I have added 
> that behavior to my local repository. And I would like to push that to 
> log4net library.
> e.g. appender configuration
> <appender
> name="ServiceAppender" 
> type="LoggingServiceAppender"               
> serviceLocatorType="Log4NetServiceLocator">



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to