I'm trying to log to different files using Nlog. For now i'm logging to two different files, one for application, second for Topshelf and Masstransit. In my app i initializing my logger like this
LogManager.GetLogger("MyLogger");
which is configured in Nlog.config.
This is Masstransit and Topshelf logging configured
NLogLogger.Use();
HostLogger.UseLogger(new NLogLogWriterFactory.NLogHostLoggerConfigurator());
How could i configure Topshelf and Masstransit 3 to use different Nlog loggers?
You can pass a LogFactory
to MassTransit in the configuration:
Bus.Factory.CreateUsingXxx(x => x.UseNLog(logFactory));
That LogFactory
can be created using a separate NLog configuration.