diff --git a/src/Umbraco.Core/Logging/Logger.cs b/src/Umbraco.Core/Logging/Logger.cs index 1818f8bf5b..563dd92681 100644 --- a/src/Umbraco.Core/Logging/Logger.cs +++ b/src/Umbraco.Core/Logging/Logger.cs @@ -7,6 +7,7 @@ using Umbraco.Core.Configuration; using Umbraco.Core.Diagnostics; using Serilog; using Serilog.Events; +using Serilog.Filters; using Serilog.Formatting.Compact; using Umbraco.Core.Logging.SerilogExtensions; @@ -34,9 +35,9 @@ namespace Umbraco.Core.Logging Serilog.Debugging.SelfLog.Enable(msg => System.Diagnostics.Debug.WriteLine(msg)); //Set this environment variable - so that it can be used in external config file - //add key="serilog:write-to:RollingFile.pathFormat" value="%BASEDIR%\logs\log-{Date}.txt" /> + //add key="serilog:write-to:RollingFile.pathFormat" value="%BASEDIR%\logs\log.txt" /> Environment.SetEnvironmentVariable("BASEDIR", AppDomain.CurrentDomain.BaseDirectory, EnvironmentVariableTarget.Process); - + Log.Logger = new LoggerConfiguration() .MinimumLevel.Verbose() //Set to highest level of logging (as any sinks may want to restrict it to Errors only) .Enrich.WithProcessId() @@ -61,9 +62,12 @@ namespace Umbraco.Core.Logging retainedFileCountLimit: null, //Setting to null means we keep all files - default is 31 days restrictedToMinimumLevel: LogEventLevel.Verbose) - //A nested logger - where any configured sinks do not effect + //Read from main serilog.config file + .ReadFrom.AppSettings(filePath: AppDomain.CurrentDomain.BaseDirectory + @"\config\serilog.config") + + //A nested logger - where any user configured sinks via config can not effect the main 'umbraco' logger above .WriteTo.Logger(cfg => - cfg.ReadFrom.AppSettings(filePath: AppDomain.CurrentDomain.BaseDirectory + @"\config\serilog.config")) + cfg.ReadFrom.AppSettings(filePath: AppDomain.CurrentDomain.BaseDirectory + @"\config\serilog.user.config")) .CreateLogger(); } diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 9952ab6b76..c2b826419f 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -83,6 +83,9 @@ 3.0.0 + + 2.0.0 + 1.0.0 diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 72c65657c2..1f214b3dba 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -279,6 +279,9 @@ HealthChecks.config Designer + + Designer + Designer diff --git a/src/Umbraco.Web.UI/config/serilog.config b/src/Umbraco.Web.UI/config/serilog.config index 9465b6b6e5..a0a8f8658a 100644 --- a/src/Umbraco.Web.UI/config/serilog.config +++ b/src/Umbraco.Web.UI/config/serilog.config @@ -1,22 +1,14 @@  - + + + + - - - - - - - - + + diff --git a/src/Umbraco.Web.UI/config/serilog.user.config b/src/Umbraco.Web.UI/config/serilog.user.config new file mode 100644 index 0000000000..ad78e8e004 --- /dev/null +++ b/src/Umbraco.Web.UI/config/serilog.user.config @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +