How can I log Castle Windsor internal logs? For example if I had misconfigured Castle in a way that is failing to load the connection string, I want to know if I can log the errors from Castle when it tries to resolve the connection string. I'm using Log4Net Facility and I'm only able to see application logs, not Windsor logs.
Your call to WindsorContainer.Resolve<> will throw an exception if the resolution fails. You should log this exception in your "bootstrapping" code that is responsible for creating the container and resolving the needed component(s). The exception message typically tells you exactly what is wrong in excruciating detail.
To my knowledge, Windsor does not do any "internal" logging via log4net (perhaps one of the contributors can correct/affirm this). If you wish to log "internal" events, you can hook up to the event handlers on the kernel (accessible via WindsorContainer.Kernel). For example, there are ComponentRegistered and DependencyResolving events that allow you to take custom action on registrations and resolutions, respectively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With