以下は私のコードです。NullReference
Logger オブジェクトの使用時に例外が発生しました。何が恋しいですか?
using Castle.Core.Logging;
using Castle.Facilities.Logging;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Castle.Windsor.Installer;
namespace log4netTest
{
internal class Program
{
private static void Main(string[] args)
{
new WindsorContainer()
.Install(FromAssembly.This());
var test = new testClass();
test.Do();
}
}
public class testClass
{
public ILogger Logger { get; set; }
public void Do()
{
Logger.Info("start");
Logger.Error("error end");
}
}
public class MyWindorInstaller : IWindsorInstaller
{
#region IWindsorInstaller Members
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.AddFacility<LoggingFacility>(facility => facility.UseLog4Net("log4net.config"));
}
#endregion
}
}