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

ASF GitHub Bot logged work on LOG4NET-565:
------------------------------------------

                Author: ASF GitHub Bot
            Created on: 27/Feb/21 18:50
            Start Date: 27/Feb/21 18:50
    Worklog Time Spent: 10m 
      Work Description: tschettler opened a new pull request #73:
URL: https://github.com/apache/logging-log4net/pull/73


   This refactors type activation into an `ActivationProvider` class, which 
provides wrapper methods for the `IActivator` interface. The default 
`IActivator` implementation (`DefaultActivator`) derives from the current logic 
which uses `Activator.CreateInstance`. Clients of log4net can set the 
IActivator instance to a custom implementation if they so choose. For an 
example use case, this will allow for dependency injection in custom appenders 
and pattern converters.
   
   I researched how to do dependency injection in custom log4net appenders and 
pattern converters without making changes to log4net itself and it proves to be 
increasingly difficult, since it would require custom classes in cases where 
Activator.CreateInstance is used. I tried to keep my changes to a bare minimum, 
as I recognize this project is one of the most popular logging frameworks in 
.NET and any changes must be heavily scrutinized.
   
   I also recognize that there have been other attempts to add this capability 
to log4net (#26, #72), but this implementation is merely a refactoring of the 
existing `Activator.CreateInstance` logic. With all due respect to the authors 
of the previous implementation attempts, this implementation provides one other 
key component that the other attempts were missing. The `IsTypeConstructible` 
method of `XmlHierarchyConfigurator` has been refactored into a 
`CanCreateInstance` method on the `IActivator` interface. This is necessary to 
allow custom activation of types without default constructors.
   
   Thanks!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

            Worklog Id:     (was: 558964)
    Remaining Estimate: 0h
            Time Spent: 10m

> 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
>            Priority: Major
>              Labels: Enhancement
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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
(v8.3.4#803005)

Reply via email to