c a n d l a n d . n e t

Castle monorail logging with windsor

Dusty Candland | |

Using Castle monorail with windsor, I setup the logging facility and followed the IoC of concept parameters for optional components. I noticed the base Controller had Logger property and assumed that windsor would handle it from there. However, my controller always had the NullLogger as the ILogger property. The base Controller class doesn’t have a setter for the Logger property. Still not sure why that is, also the property is not virtual. I should submit a patch for this. Anyway, one solution is to create a new property Logger in your own Controller with a getter and setter thus allowing windsor to set the Logger when the Controller is created.

public abstract class BaseSiteController : ARSmartDispatcherController
{
private ILogger _logger = new NullLogger();

public new virtual ILogger Logger {
get { return _logger; }
set { _logger = value; }
}
}

Webmentions

These are webmentions via the IndieWeb and webmention.io. Mention this post from your site: