Skip to content

Register logger in container (log4net) #2335

Answered by dansiegel
ErwinDraconis asked this question in WPF
Discussion options

You must be logged in to vote

Other than the use of Open Generics, Prism's abstractions don't really have a way of handling the more complex factory that would be required to produce an instance of ILog with the name of the type that it is injected into. Not to say that it can't be done, but you will have to look to the underlying container for how to more appropriately handle this situation.

As was already suggested you might try Unity.Log4Net if you are using Unity... If you're using DryIoc you may look to this sample from @dadhi on how to configure the container with Serilog.

https://github.com/dadhi/DryIoc/blob/master/docs/DryIoc.Docs/ExamplesContextBasedResolution.md#serilog-logger

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@Pretasoc
Comment options

@ErwinDraconis
Comment options

Comment options

You must be logged in to vote
1 reply
@ErwinDraconis
Comment options

Answer selected by ErwinDraconis
Comment options

You must be logged in to vote
1 reply
@ErwinDraconis
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
WPF
Labels
None yet
4 participants