Skip to content

A log entry produced within a scope should contain the properties defined on the scope #27

@penenkel

Description

@penenkel

When producing a log entry from within a scope, as in this sample

            var loggerFactory = TestLoggerFactory.Create();
            var logger = loggerFactory.CreateLogger<Sample>();
            using (logger.BeginScope(new Dictionary<string, object>() { { "property0", "value0" } }))
            {
                logger.LogInformation("message {property2}", "value2");
            }

I expected loggerFactory .Sink.LogEntries[0].Properties to contain both properties, but found only propertiy2. Whereas property0 only seems to be captured in loggerFactory.Sink.Scopes[0].Properties. Is this intentional?

This article seems to indicate that this is not the behavior of the "real" implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions