using Amazon.CloudWatchLogs;
using Serilog.Sinks.AwsCloudWatch;
internal class Program
{
static async Task Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
.WriteTo.AmazonCloudWatch(
logGroup: LogGroup,
logStreamPrefix: DateTime.UtcNow.ToString("yyyyMMddHHmmssfff"),
cloudWatchClient: client)
.WriteTo.Console()
.CreateLogger();
Log.Information("Application Started"); /*only logs this one*/
Log.Information("Application Started1");
Log.Information("Application Started2");
Log.Information("Application Started3");
Log.Information("Application Started4");
var host = Host.CreateDefaultBuilder(args)
.ConfigureServices((_, services) =>
.AddSingleton<Serilog.ILogger>(Log.Logger)
).UseSerilog()
.Build();
var getDDD = ActivatorUtilities.CreateInstance\<GetDDD\>(host.Services);
await getDDD.LoadDDD();
}
}
I have created a logger using serilog and trying to add it to AWS cloudwatch. But only 1st log get added and rest get skipped. I want to all logs to cloudwatch