[
https://issues.apache.org/jira/browse/LOG4NET-565?focusedWorklogId=671798&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-671798
]
ASF GitHub Bot logged work on LOG4NET-565:
------------------------------------------
Author: ASF GitHub Bot
Created on: 29/Oct/21 04:28
Start Date: 29/Oct/21 04:28
Worklog Time Spent: 10m
Work Description: tschettler commented on pull request #73:
URL: https://github.com/apache/logging-log4net/pull/73#issuecomment-954420832
@fluffynuts thanks again for the response and great idea!
I think we are in agreement. I like the idea of log4net having its own
container, and allowing services to be registered within that container. I
agree that a minimalist approach is probably best to start. I think the risks
you mentioned are effectively mitigated with this approach and, if implemented
correctly, third parties will not really be able to change how services are
constructed since that would all be either in the "user-land" or within
log4net. They could add service registrations of their own, but if they are not
dependencies within an expected type registered with log4net, log4net would
never construct them.
I see this type of factory method as highly desirable:
```cs
Log4NetContainer.Instance.Register<IService>(() =>
container.Resolve<IService>());
```
In my opinion, this factory approach will probably be the most beneficial,
and with the aim to provide a minimalist implementation, it would be less
impactful to just support transient or singleton scoped instances from the
start. Dealing with scoped services can (as you know) much more easily lead to
captive dependencies without providing some sort of service lifetime indicator
to log4net. This would then require log4net to create new instances of types
when a scoped service has been disposed and the higher level service is to be
executed again.
This conversation has evolved beyond the scope of this PR. What do you see
as the next steps?
Thanks!
Travis
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 671798)
Time Spent: 1.5h (was: 1h 20m)
> 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: 1.5h
> 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)