f44c32d501
Fix PROG gestione TaskMan
56 lines
1.7 KiB
C#
56 lines
1.7 KiB
C#
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.Extensions.Logging;
|
|
using NLog;
|
|
using NLog.Web;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MP.Stats
|
|
{
|
|
public class Program
|
|
{
|
|
#region Public Methods
|
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
|
Host.CreateDefaultBuilder(args)
|
|
.ConfigureWebHostDefaults(webBuilder =>
|
|
{
|
|
webBuilder.UseStartup<Startup>();
|
|
})
|
|
.ConfigureLogging(logging =>
|
|
{
|
|
logging.ClearProviders();
|
|
logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Information);
|
|
})
|
|
// importante per eseguire la conf logging
|
|
.UseNLog(new NLogAspNetCoreOptions() { RemoveLoggerFactoryFilter = false });
|
|
|
|
public static void Main(string[] args)
|
|
{
|
|
// inclusione NLog:
|
|
var logger = LogManager.Setup()
|
|
.LoadConfigurationFromAppSettings()
|
|
.GetCurrentClassLogger();
|
|
try
|
|
{
|
|
logger.Info("MP.STATS Application Starting Up");
|
|
CreateHostBuilder(args).Build().Run();
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
logger.Error(exception, "Stopped MP.STATS program because of exception");
|
|
throw;
|
|
}
|
|
finally
|
|
{
|
|
LogManager.Shutdown();
|
|
}
|
|
}
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |