diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/GlobalUsings.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/GlobalUsings.cs index 9aff586f4..c008e8b3e 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/GlobalUsings.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/GlobalUsings.cs @@ -24,7 +24,6 @@ global using Microsoft.Extensions.Hosting; global using Microsoft.Extensions.Logging; global using Microsoft.Extensions.Options; global using Microsoft.OpenApi.Models; -global using Serilog; global using Swashbuckle.AspNetCore.SwaggerGen; global using System.Collections.Generic; global using System.IdentityModel.Tokens.Jwt; @@ -37,4 +36,3 @@ global using System.Threading.Tasks; global using System.Threading; global using System; global using Microsoft.IdentityModel.Tokens; -global using Serilog.Context; diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Program.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Program.cs index dc792b866..50df67c3e 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Program.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Program.cs @@ -1,6 +1,6 @@ var builder = WebApplication.CreateBuilder(args); -builder.Host.UseSerilog(CreateSerilogLogger(builder.Configuration)); +builder.Logging.AddConsole(); builder.Services.AddHealthChecks() .AddCheck("self", () => HealthCheckResult.Healthy()) .AddUrlGroup(new Uri(builder.Configuration["CatalogUrlHC"]), name: "catalogapi-check", tags: new string[] { "catalogapi" }) @@ -21,6 +21,7 @@ else { app.UseExceptionHandler("/Home/Error"); } + var pathBase = builder.Configuration["PATH_BASE"]; if (!string.IsNullOrEmpty(pathBase)) { @@ -56,41 +57,7 @@ app.MapHealthChecks("/liveness", new HealthCheckOptions Predicate = r => r.Name.Contains("self") }); -try -{ - Log.Information("Starts Web Application ({ApplicationContext})...", Program.AppName); - await app.RunAsync(); - - return 0; -} -catch (Exception ex) -{ - Log.Fatal(ex, "Program terminated unexpectedly ({ApplicationContext})!", Program.AppName); - return 1; -} -finally -{ - Log.CloseAndFlush(); -} - -Serilog.ILogger CreateSerilogLogger(IConfiguration configuration) -{ - var seqServerUrl = configuration["Serilog:SeqServerUrl"]; - var logstashUrl = configuration["Serilog:LogstashgUrl"]; - return new LoggerConfiguration() - .MinimumLevel.Verbose() - .Enrich.WithProperty("ApplicationContext", Program.AppName) - .Enrich.FromLogContext() - .WriteTo.Console() - .ReadFrom.Configuration(configuration) - .CreateLogger(); -} -public partial class Program -{ - - public static string Namespace = typeof(Program).Assembly.GetName().Name; - public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1); -} +await app.RunAsync(); public static class ServiceCollectionExtensions { diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj b/src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj index 782c730ab..5d486d3c6 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj @@ -26,8 +26,6 @@ - -