Adds an env variable (set to process level) so that the external config can use it to save files with a relative path
This commit is contained in:
@@ -31,6 +31,11 @@ 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" />
|
||||
Environment.SetEnvironmentVariable("BASEDIR", AppDomain.CurrentDomain.BaseDirectory, EnvironmentVariableTarget.Process);
|
||||
|
||||
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.MinimumLevel.Debug() //Set to highest level of logging (as any sinks may want to restrict it to Errors only)
|
||||
.Enrich.WithProcessId()
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<!-- Write to a user log file -->
|
||||
<add key="serilog:using:File" value="Serilog.Sinks.File" />
|
||||
<add key="serilog:write-to:File.path" value="c:/code/warren-log.txt" /><!-- Can we do a relative path to website ? -->
|
||||
<add key="serilog:write-to:File.path" value="%BASEDIR%\logs\warren-log.txt" /><!-- Can we do a relative path to website ? -->
|
||||
<add key="serilog:write-to:File.restrictedToMinimumLevel" value="Debug" />
|
||||
<add key="serilog:write-to:File.retainedFileCountLimit" value="32" /> <!-- Number of log files to keep (or remove value to keep all files) -->
|
||||
<add key="serilog:write-to:File.rollingInterval" value="Day" /> <!-- Create a new log file every Minute/Hour/Day/Month/Year/infinite -->
|
||||
|
||||
Reference in New Issue
Block a user