Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Umbraco.Core/Logging/Serilog/LoggerConfigExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static LoggerConfiguration MinimalConfiguration(this LoggerConfiguration
//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.txt" />
Environment.SetEnvironmentVariable("BASEDIR", AppDomain.CurrentDomain.BaseDirectory, EnvironmentVariableTarget.Process);
Environment.SetEnvironmentVariable("MACHINENAME", Environment.MachineName, EnvironmentVariableTarget.Process);

logConfig.MinimumLevel.Verbose() //Set to highest level of logging (as any sinks may want to restrict it to Errors only)
.Enrich.WithProcessId()
Expand Down
2 changes: 0 additions & 2 deletions src/Umbraco.Core/Logging/Serilog/SerilogLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ public static SerilogLogger CreateWithDefaultConfiguration()
var loggerConfig = new LoggerConfiguration();
loggerConfig
.MinimalConfiguration()
.OutputDefaultTextFile(LogEventLevel.Debug)
.OutputDefaultJsonFile()
.ReadFromConfigFile()
.ReadFromUserConfigFile();

Expand Down
25 changes: 23 additions & 2 deletions src/Umbraco.Web.UI/config/serilog.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,34 @@
<configuration>
<appSettings>

<!-- Used to toggle the loge levels for the main Umbraco log files -->
<!-- Used to toggle the log levels for the main Umbraco log files -->
<!-- Found at /app_data/logs/ -->
<!-- NOTE: Changing this will also flow down into serilog.user.config -->
<!-- VALID Values: Verbose, Debug, Information, Warning, Error, Fatal -->
<add key="serilog:minimum-level" value="Information" />

<!-- To write to new log locations (aka Sinks) such as your own .txt files, ELMAH.io, Elastic, SEQ -->
<!-- NOTE: Only one logger below can be enabled, you cannot log JSON & TXT files at the same time -->

<!-- Default JSON log file -->
<!-- This is used by the defualt log viewer in the Umbraco backoffice -->
<add key="serilog:using:File" value="Serilog.Sinks.File" />
<add key="serilog:write-to:File.formatter" value="Serilog.Formatting.Compact.CompactJsonFormatter, Serilog.Formatting.Compact" />
<add key="serilog:write-to:File.path" value="%BASEDIR%\App_Data\Logs\UmbracoTraceLog.%MACHINENAME%..json" />
<add key="serilog:write-to:File.shared" value="true" />
<add key="serilog:write-to:File.restrictedToMinimumLevel" value="Debug" />
<add key="serilog:write-to:File.retainedFileCountLimit" value="" /> <!-- Number of log files to keep (or remove value to keep all files) -->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be string.Empty ? (I have no idea .. may be right - just checking)

@warrenbuckley warrenbuckley Feb 12, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its either null/not set here or specify the number of files to keep (if set to days) it will be the number of days files to keep for example. Default out of box for V8 will keep all files.

But should we ship/consider setting this to say 30ish for a month out of the box?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I say keep them all for now, we can change at a later date if needed.

<add key="serilog:write-to:File.rollingInterval" value="Day" /> <!-- Create a new log file every Minute/Hour/Day/Month/Year/infinite -->

<!-- Optional TXT log file -->
<!--<add key="serilog:using:File" value="Serilog.Sinks.File" /> -->
<!--<add key="serilog:write-to:File.path" value="%BASEDIR%\App_Data\Logs\UmbracoTraceLog.%MACHINENAME%..txt" /> -->
Comment thread
clausjensen marked this conversation as resolved.
<!--<add key="serilog:write-to:File.shared" value="true" /> -->
<!--<add key="serilog:write-to:File.restrictedToMinimumLevel" value="Debug" /> -->
<!--<add key="serilog:write-to:File.retainedFileCountLimit" value="" /> --> <!-- 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 -->
<!--<add key="serilog:write-to:File.outputTemplate" value="{Timestamp:yyyy-MM-dd HH:mm:ss,fff} [P{ProcessId}/D{AppDomainId}/T{ThreadId}] {Log4NetLevel} {SourceContext} - {Message:lj}{NewLine}{Exception}" /> -->

<!-- To write to new log locations (aka Sinks) such as your own .txt files with filtering, ELMAH.io, Elastic, SEQ -->
<!-- Please use the serilog.user.config file to configure your own logging needs -->

</appSettings>
Expand Down