Skip to content

.ReadFrom.AppSettings(prefix) silently ignores missing settings #54

@Xerillio

Description

@Xerillio

When using the AppSettings(prefix) overload, Serilog neither fails nor complains in the SelfLog about not finding any appSettings with that prefix.

How to reproduce

Create a project with no serilog related settings in web.config/app.config.

Setup SelfLog:

Serilog.Debugging.SelfLog.Enable(Console.Error); // Or some other destination of choice

Create a logger with any prefix:

var logger = new LoggerConfiguration()
    .ReadFrom.AppSettings("MyLoggerA")
    .CreateLogger();

logger.Information("Some log message");

Notice there's nothing written to Console.Error.

I can't figure out if that's by design or not, but it seems unintuitive, that this should silently go through without at least a warning in SelfLog.


If I instead add settings like:

<add key="MyLoggerA:serilog:using:File" value="Serilog.Sinks.File" />
<add key="MyLoggerA:serilog:write-to:File.path" value="Q:\Logs\Foged\Server\ApplicationLog.txt" />

It complains in SelfLog as I don't have a Q: drive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions