diff --git a/GerstITS.Examples.Api/GerstITS.Examples.Api.csproj b/GerstITS.Examples.Api/GerstITS.Examples.Api.csproj index d9f2a66..865c751 100644 --- a/GerstITS.Examples.Api/GerstITS.Examples.Api.csproj +++ b/GerstITS.Examples.Api/GerstITS.Examples.Api.csproj @@ -37,18 +37,19 @@ - - + + + - + - + diff --git a/GerstITS.Examples.Api/Program.cs b/GerstITS.Examples.Api/Program.cs index 2b14cdd..162368d 100644 --- a/GerstITS.Examples.Api/Program.cs +++ b/GerstITS.Examples.Api/Program.cs @@ -1,3 +1,4 @@ +using GerstITS.Logging.Serilog; using GerstITS.Web.Api.Hosting; namespace GerstITS.Examples.Api @@ -8,12 +9,13 @@ namespace GerstITS.Examples.Api public static void Main(string[] args) { - Run(args); + BootstrapLogContext.Execute(_ => Run(args)); } protected override void ConfigureWebHost(IWebHostBuilder webHostBuilder) { - webHostBuilder.UseStartup(); + webHostBuilder.UseLogging() + .UseStartup(); } #endregion diff --git a/GerstITS.Examples.Api/appsettings.json b/GerstITS.Examples.Api/appsettings.json index a3900f2..ea76fa0 100644 --- a/GerstITS.Examples.Api/appsettings.json +++ b/GerstITS.Examples.Api/appsettings.json @@ -18,5 +18,34 @@ "SayHelloWorldJob": { "CronExpression": "*/30 * * * * ? *", "Name": "Example Job" + }, + "Serilog": { + "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.RollingFile" ], + "MinimumLevel": { + "Default": "Debug", + "Override": { + "Microsoft": "Debug", + "System": "Debug" + } + }, + "WriteTo": [ + { + "Name": "Console", + "Args": { + "outputTemplate": "===> {Timestamp:HH:mm:ss} [{Level}] {Message}{NewLine}{Exception}" + } + }, + { + "Name": "RollingFile", + "Args": { + "pathFormat": "bin/Debug/net5.0/Logs/{Date}.log.json", + "formatter": "Serilog.Formatting.Compact.CompactJsonFormatter, Serilog", + "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] [{SourceContext}] [{EventId}] {Message}{NewLine}{Exception}", + "retainedFileCountLimit": 90, + "rollingInterval": "Day", + "shared": true + } + } + ] } } diff --git a/GerstITS.Examples.Jobs.SayHelloWorld/GerstITS.Examples.Jobs.SayHelloWorld.csproj b/GerstITS.Examples.Jobs.SayHelloWorld/GerstITS.Examples.Jobs.SayHelloWorld.csproj index 191e9ff..0f4e622 100644 --- a/GerstITS.Examples.Jobs.SayHelloWorld/GerstITS.Examples.Jobs.SayHelloWorld.csproj +++ b/GerstITS.Examples.Jobs.SayHelloWorld/GerstITS.Examples.Jobs.SayHelloWorld.csproj @@ -34,7 +34,7 @@ - + diff --git a/GerstITS.Examples.Logic/GerstITS.Examples.Logic.csproj b/GerstITS.Examples.Logic/GerstITS.Examples.Logic.csproj index 9451ec5..a9d4519 100644 --- a/GerstITS.Examples.Logic/GerstITS.Examples.Logic.csproj +++ b/GerstITS.Examples.Logic/GerstITS.Examples.Logic.csproj @@ -34,13 +34,13 @@ - - + + - - + + diff --git a/GerstITS.Examples.Logic/Module.Example.cs b/GerstITS.Examples.Logic/Module.Example.cs index 5100845..39e997a 100644 --- a/GerstITS.Examples.Logic/Module.Example.cs +++ b/GerstITS.Examples.Logic/Module.Example.cs @@ -1,5 +1,5 @@ -using GerstITS.AutoMapper; -using GerstITS.Examples.Logic.Example; +using GerstITS.Examples.Logic.Example; +using GerstITS.Mapping.AutoMapper; using Microsoft.Extensions.DependencyInjection; namespace GerstITS.Examples.Logic diff --git a/GerstITS.Examples.WebClient.Console/GerstITS.Examples.WebClient.Console.csproj b/GerstITS.Examples.WebClient.Console/GerstITS.Examples.WebClient.Console.csproj index 8ed9afd..76b8394 100644 --- a/GerstITS.Examples.WebClient.Console/GerstITS.Examples.WebClient.Console.csproj +++ b/GerstITS.Examples.WebClient.Console/GerstITS.Examples.WebClient.Console.csproj @@ -45,7 +45,7 @@ - + diff --git a/GerstITS.WebClients.Example.Api/GerstITS.Examples.WebClients.Examples.Api.csproj b/GerstITS.WebClients.Example.Api/GerstITS.Examples.WebClients.Examples.Api.csproj index 73882e8..7a0b5aa 100644 --- a/GerstITS.WebClients.Example.Api/GerstITS.Examples.WebClients.Examples.Api.csproj +++ b/GerstITS.WebClients.Example.Api/GerstITS.Examples.WebClients.Examples.Api.csproj @@ -33,7 +33,7 @@ - +