diff --git a/build/NuSpecs/tools/serilog.config.install.xdt b/build/NuSpecs/tools/serilog.config.install.xdt
index 838a1f1a07..e0df2985c7 100644
--- a/build/NuSpecs/tools/serilog.config.install.xdt
+++ b/build/NuSpecs/tools/serilog.config.install.xdt
@@ -3,10 +3,7 @@
-
-
-
-
+
diff --git a/src/Umbraco.Core/Logging/Serilog/LoggerConfigExtensions.cs b/src/Umbraco.Core/Logging/Serilog/LoggerConfigExtensions.cs
index c162e4686b..951d6f8787 100644
--- a/src/Umbraco.Core/Logging/Serilog/LoggerConfigExtensions.cs
+++ b/src/Umbraco.Core/Logging/Serilog/LoggerConfigExtensions.cs
@@ -70,8 +70,6 @@ namespace Umbraco.Core.Logging.Serilog
///
public static LoggerConfiguration File(this LoggerSinkConfiguration configuration, ITextFormatter formatter,
string path,
- bool shared = false,
- bool buffered = false,
LogEventLevel restrictedToMinimumLevel = LogEventLevel.Verbose,
LoggingLevelSwitch levelSwitch = null,
long? fileSizeLimitBytes = 1073741824,
@@ -79,56 +77,26 @@ namespace Umbraco.Core.Logging.Serilog
RollingInterval rollingInterval = RollingInterval.Infinite,
bool rollOnFileSizeLimit = false,
int? retainedFileCountLimit = 31,
- Encoding encoding = null,
- bool async = false,
- bool asyncBlockWhenFull = false,
- int asyncBufferSize = 10000,
- bool asyncKeepFileOpen = true)
+ Encoding encoding = null
+ )
{
- LoggerConfiguration GetFileSink(LoggerSinkConfiguration c)
- {
- return c.File(
- formatter,
- path,
- restrictedToMinimumLevel,
- fileSizeLimitBytes,
- levelSwitch,
- buffered,
- shared,
- flushToDiskInterval,
- rollingInterval,
- rollOnFileSizeLimit,
- retainedFileCountLimit,
- encoding);
- }
-
- if (!async && !asyncKeepFileOpen)
- {
- throw new InvalidOperationException($"{nameof(asyncKeepFileOpen)} cannot be changed if async is false.");
- }
- if (!async && rollOnFileSizeLimit)
- {
- throw new InvalidOperationException($"{nameof(rollOnFileSizeLimit)} cannot be changed if async is false.");
- }
-
- if (async)
- {
- Action configure;
- if (asyncKeepFileOpen)
- {
- configure = a => GetFileSink(a);
- }
- else
- {
- // This is a way to force the file to be closed after each log event. Read more https://github.com/serilog/serilog-sinks-file/issues/99#issuecomment-488612711
- // We basically map all log events with a AppDomainId property (all events) into a file sink and forces the sink to be closed, due to the sinkMapCountLimit = 0.
- configure = a => a.Map(AppDomainId, (name,c) => GetFileSink(c), sinkMapCountLimit:0);
- }
-
- return configuration.Async(configure, blockWhenFull: asyncBlockWhenFull, bufferSize: asyncBufferSize);
-
- }
- return GetFileSink(configuration);
+ return configuration.Async(
+ asyncConfiguration => asyncConfiguration.Map(AppDomainId, (_,mapConfiguration) =>
+ mapConfiguration.File(
+ formatter,
+ path,
+ restrictedToMinimumLevel,
+ fileSizeLimitBytes,
+ levelSwitch,
+ buffered:true,
+ shared:false,
+ flushToDiskInterval,
+ rollingInterval,
+ rollOnFileSizeLimit,
+ retainedFileCountLimit,
+ encoding),
+ sinkMapCountLimit:0)
+ );
}
diff --git a/src/Umbraco.Web.UI/config/serilog.Release.config b/src/Umbraco.Web.UI/config/serilog.Release.config
index 80b20c6412..4d9151b2fd 100644
--- a/src/Umbraco.Web.UI/config/serilog.Release.config
+++ b/src/Umbraco.Web.UI/config/serilog.Release.config
@@ -20,13 +20,10 @@
-
-
-
-
+