For my WebAPI, .UseSerilog() seems to work as expected on the LocalEntryPoint om my .Net Core 3.1 api running on my local box. However, when i deploy to AWS Lambda using LambdaEntryPoint's IWebHostBuilder it does not seem to log anything. My LambdaEntryPoint's IWebhostBuilder is:
protected override void Init(IWebHostBuilder builder)
{
try
{
builder
.ConfigureLogging(logger =>
{
logger.ClearProviders();
logger.AddSerilog(dispose: true);
);
Log.Information("The IWebHostBuilder has been built");
}
catch (System.Exception ex)
{
Log.Fatal(ex, ex.Message);
}
finally
{
Log.CloseAndFlush();
}
}
Has anyone found a way to log using serilog in applications deployed in AWS Lambda?
WriteToto specify a sink for log messages - Panagiotis Kanavos