public static void Main() { var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); var logConfiguration = new LogConfiguration(); configuration.GetSection("LogConfiguration").Bind(logConfiguration); LogManager.Configure(logConfiguration); Log.Info("Starting worker..."); using (var container = ContainerSetup.Create(configuration)) { // eager load the singleton, so that is starts consuming messages var messageBus = container.Resolve <IMessageBus>(); Log.Info("Worker ready"); Console.WriteLine("Press enter to stop the application..."); Console.ReadLine(); Log.Info("Stopping worker..."); } Log.Info("Worker stopped"); }
static void Main(string[] args) { Log.Info("Starting worker..."); using (var container = ContainerSetup.Create()) { var messagBus = container.Resolve <IMessageBus>(); Log.Info("Worker ready"); Console.WriteLine("Press enter to stop the application..."); Console.ReadLine(); Log.Info("Stopping worker..."); } Log.Info("Worker stopped"); }
public static void Main() { var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); var loggerFactory = LoggerFactory.Create(cfg => cfg.AddConfiguration(configuration.GetSection("Logging")).AddConsole()); var logger = loggerFactory.CreateLogger <Program>(); logger.LogInformation("Starting worker..."); using (var container = ContainerSetup.Create(configuration, loggerFactory)) { // eager load the singleton, so that is starts consuming messages var messageBus = container.Resolve <IMessageBus>(); logger.LogInformation("Worker ready"); Console.WriteLine("Press enter to stop the application..."); Console.ReadLine(); logger.LogInformation("Stopping worker..."); } logger.LogInformation("Worker stopped"); }