diff --git a/Startup.cs b/Startup.cs index c5da0e0..41c804a 100644 --- a/Startup.cs +++ b/Startup.cs @@ -6,6 +6,7 @@ using Newtonsoft.Json; using xApi.Extensions; using xHttpService.DI; using System.Reflection; +using xLoggingService.DI; using xCommons.Extensions; using xDataService.Models; using xIdentityService.DI; @@ -41,6 +42,7 @@ namespace xApi public void ConfigureServices(IServiceCollection services) { + services.AddXLoggingService(Configuration); // // Register Validation Provider and all XCommons Module Services ... services.AddXCommons(Configuration); @@ -119,7 +121,10 @@ namespace xApi ); } - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + public void Configure( + IApplicationBuilder app, + IWebHostEnvironment env + ) { // if (env.IsDevelopment()) @@ -127,6 +132,10 @@ namespace xApi app.UseDeveloperExceptionPage(); } + // + // Setting Environment in App Confiuration ... + app.AddEnvironmentToXAppConfiguration(env.EnvironmentName); + // // Use Swagger Middleware ... app.UseXSwagger(); @@ -169,4 +178,6 @@ namespace xApi ); } } -} \ No newline at end of file +} + + diff --git a/appsettings.json b/appsettings.json index 2ff5a76..764952f 100644 --- a/appsettings.json +++ b/appsettings.json @@ -185,7 +185,41 @@ "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" + }, + "XLogger": { + "Enabled": true, + "ApplicationName": "xApi", + "EnvironmentName": "Production", + "MinimumLevel": "Information", + "Queue": { + "Enabled": true, + "Capacity": 10000, + "ShutdownTimeoutSeconds": 10 + }, + "File": { + "Enabled": true, + "Directory": "./Logs", + "FileName": "xApi-.log", + "Format": "Json", + "MinimumLevel": "Information", + "RetainedFileCountLimit": 30 + }, + "Database": { + "Enabled": false, + "Provider": "Microsoft.Data.Sqlite", + "ConnectionString": "Filename=./Db/XLogs.db", + "TableName": "XLogs", + "AutoCreateTable": true, + "MinimumLevel": "Warning" + }, + "Event": { + "Enabled": false, + "Topic": "application-logs", + "Action": "ApplicationLogCreated", + "Sender": "xApi", + "MinimumLevel": "Error" + } } }, "AllowedHosts": "*" -} \ No newline at end of file +} diff --git a/xApi.csproj b/xApi.csproj index 4b940b9..3b12c92 100644 --- a/xApi.csproj +++ b/xApi.csproj @@ -7,47 +7,37 @@ xSaherElm.xApi SaherElm IT Center netcoreapp3.1 - a WebAPI Project which contains all Business Logic of xSaherElm Project. - icon.png - false false - - + - - - - $(NoWarn);1591 true true - @@ -55,9 +45,11 @@ all - + + + \ No newline at end of file