Skip to content

Need to be able to specify dispose:true #22

Open
@danielabbatt

Description

@danielabbatt

I tried to use this in a console application but found that if I logged and exited immediately then the log file was not flushed, there was no opportunity to specify the dispose.
I ended up doing the below in the end.

// Set up Serilog
Log.Logger = new LoggerConfiguration()
	.WriteTo.RollingFile(logFilename)
        .CreateLogger();

// Add logging
services.AddSingleton(
	new LoggerFactory()
		.AddSerilog(dispose:true)
		.AddConsole(loggingConfiguration)
		.AddDebug(LogLevel.Trace)
);

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