serilog-archive/serilog-sinks-azuredocumentdb

Nothing logged written to database

MPapst opened this issue · 1 comments

Hi,

I tried a minimal sample with a cosmosdb, but unfortunately I do not see any documents dropped into the database.

Sample:

class Program
    {
        static void Main()
        {
            using (var logger = new LoggerConfiguration()
                .Enrich.FromLogContext()
                .Enrich.WithProperty("Application", "Test-Console")
                .WriteTo.AzureDocumentDB(
                    "https://mpa-logtest-core.documents.azure.com:443/", 
                    "****",
                    restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Verbose,
                    storeTimestampInUtc: true,
                    timeToLive: 60*60*24*14,
                    logBufferSize: 1000,
                    batchSize: 10)
                .WriteTo.Console()
                .CreateLogger())
            {

                Log.Logger = logger;

                logger.Information("Test");
                logger.Error(new Exception("Test"), "Exception");

                Enumerable.Range(1, 10000).ToList().ForEach(x => logger.Fatal("Hallo {x}", x));


                Console.WriteLine("Hello World!");

            }

            //Thread.Sleep(600 * 1000);

            Log.CloseAndFlush();
        }
    }

Even with the Wait time, nothing happens in the database.
I see a lot of traffice between my PC and the database endpoint, which is actually TLS encrypted, but it is there.

Anything I am doing wrong?

Edit: code sample changed to Cosmos DB from Mongo DB (supplied the wrong test)

... sometimes it "just works" if you try it once more :)