ChangemakerStudios / serilog-sinks-mongodb

A sink for Serilog that writes events to MongoDB
Apache License 2.0
90 stars 51 forks source link

V5 regression #66

Closed Nexus452 closed 2 years ago

Nexus452 commented 2 years ago

Hi,

After updating to V5, my code no longer works. To reproduce :

 var logger = new LoggerConfiguration()
            .Enrich.FromLogContext()
            .WriteTo.MongoDB(
                context.Database,
                period: TimeSpan.FromSeconds(1),
                batchPostingLimit: 10
                ).WriteTo.Console()
            .CreateLogger();

        for (int i = 0; i <500; i++)
        {
            logger.Information("Tst");
            Thread.Sleep(150);
        }

It breaks in the legacy sink when writing the end of the json document :

payload.Write("]}");

Somehow the json is maflformated.

Thanks

Jaben commented 2 years ago

Try latest dev.