Class UmbracoFileConfiguration
Provides configuration settings for file-based logging in Umbraco using Serilog.
Inheritance
Namespace: Umbraco.Cms.Infrastructure.Logging.Serilog
Assembly: Umbraco.Infrastructure.dll
Syntax
public class UmbracoFileConfiguration
Constructors
View SourceUmbracoFileConfiguration(IConfiguration)
Initializes a new instance of the UmbracoFileConfiguration class using the specified configuration.
Declaration
public UmbracoFileConfiguration(IConfiguration configuration)
Parameters
| Type | Name | Description |
|---|---|---|
| IConfiguration | configuration | The Microsoft.Extensions.Configuration.IConfiguration instance used to configure the file settings. |
Properties
View SourceEnabled
Gets or sets a value indicating whether file logging for Umbraco is enabled.
Declaration
public bool Enabled { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
FileSizeLimitBytes
Gets or sets the maximum size, in bytes, that a log file can reach before it is rolled over.
Declaration
public long FileSizeLimitBytes { get; set; }
Property Value
| Type | Description |
|---|---|
| long |
FlushToDiskInterval
Gets or sets the interval at which the log file buffer is flushed to disk. A shorter interval may reduce data loss in case of a crash, but can impact performance.
Declaration
public TimeSpan? FlushToDiskInterval { get; set; }
Property Value
| Type | Description |
|---|---|
| TimeSpan? |
RestrictedToMinimumLevel
Gets or sets the minimum log event level allowed for logging.
Declaration
public LogEventLevel RestrictedToMinimumLevel { get; set; }
Property Value
| Type | Description |
|---|---|
| LogEventLevel |
RetainedFileCountLimit
Gets or sets the maximum number of log files to retain.
Declaration
public int RetainedFileCountLimit { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
RollOnFileSizeLimit
Gets or sets a value indicating whether the log file should be rolled over when it reaches the configured file size limit.
Declaration
public bool RollOnFileSizeLimit { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
RollingInterval
Gets or sets the interval that determines how frequently a new log file is created (for example, daily or hourly).
Declaration
public RollingInterval RollingInterval { get; set; }
Property Value
| Type | Description |
|---|---|
| RollingInterval |
Methods
View SourceGetPath(string)
Gets the full path for the log file based on the specified log directory.
Declaration
public string GetPath(string logDirectory)
Parameters
| Type | Name | Description |
|---|---|---|
| string | logDirectory | The directory where log files are stored. |
Returns
| Type | Description |
|---|---|
| string | The full path to the log file. |
GetPath(string, string, params string[])
Constructs the full path for the log file based on the specified directory, file name format, and arguments.
Declaration
public string GetPath(string logDirectory, string fileNameFormat, params string[] fileNameArgs)
Parameters
| Type | Name | Description |
|---|---|---|
| string | logDirectory | The directory where the log file will be stored. |
| string | fileNameFormat | The format string used to generate the log file name. |
| string[] | fileNameArgs | Optional arguments to format the file name. |
Returns
| Type | Description |
|---|---|
| string | The full path of the log file as a string. |