Topshelf program:
public class Program { public static void Main(string[] args) { HostFactory.Run(hostConfigurator => { hostConfigurator.UseLog4Net("..\\..\\App.config"); hostConfigurator.Service<bird>(serviceConfigurator => { serviceConfigurator.ConstructUsing(name => new Bird()); serviceConfigurator.WhenStarted(nm => nm.Start()); }); }); } } public class Bird { public void Start() { HostLogger.Get<bird>().Info("Chirp, chirp!"); } }
App.config: