I'm trying to use NLog (3.1) with Windsor Castle Facility, but it's not working for me (no errors, nothing happens)
These are my steps so far:
- Downloaded from Nuget: Castle Windsor NLog integration
- Downloaded from Nuget: NLog Configuration
Updates nlog config like this:
<target xsi:type="File" name="f" fileName="d:\nlog.log" layout="${longdate}|${level:uppercase=true}|${logger}|${message}" />
<logger name="*" minlevel="Trace" writeTo="f" />
Added Windsor Installer
public class LoggingInstaller : IWindsorInstaller { public void Install(IWindsorContainer container, IConfigurationStore store) { container.AddFacility<LoggingFacility>(f => f.LogUsing(LoggerImplementation.NLog).WithConfig("NLog.config")); } }
Which I'm calling it (I've checked that a breakpoint in there is being hit.
Added the logger class like this:
namespace WebApi.App_Start { public class MyLogger { private ILogger logger = NullLogger.Instance; public ILogger Logger { get { return logger; } set { logger = value; } } } }
Using it in a controller like this:
new MyLogger().Logger.Info("New Request Created.");
But I don't see the file created.
Any step missing?
Thanks in advance. Guillermo.