Skip to content

Exception caught when writing error log to fileSystem.IO.IOException: Read-only file system : '/var/task/aws-logger-errors.txt' #201

@pponzano

Description

@pponzano

Describe the bug

I've introduced serilog to some AWS lambda I wrote... when I run them I got this... any suggestion?

Here's my code

  public static void InitializeLogger()
        {
            AWSLoggerConfig configuration = new AWSLoggerConfig();

            Log.Logger = new LoggerConfiguration()
                .WriteTo.AWSSeriLog(configuration)
                .CreateLogger();

            var serviceCollection = new ServiceCollection();
            ConfigureServices(serviceCollection);

            serviceCollection.AddLogging(loggingBuilder =>
                loggingBuilder.AddSerilog(dispose: true));
        }

and when I log it's something as

   Log.Logger.Information($"Request inserted with Token: {guid}\n");

Any suggestion?
Thanks

Expected Behavior

The fact that the logs are correcly written to the CloudWatch

Current Behavior

This error is written in cloudwatch but no other application logs are written

Reproduction Steps

see up

Possible Solution

No response

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

AWS Lambda core 2.1.0

Targeted .NET Platform

.NET6

Operating System and version

Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.module/loggingresponse-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions