• Articles
  • Api Documentation
Show / Hide Table of Contents
  • Dapplo.Log
    • AbstractLogger
    • ILogger
    • ILoggerConfiguration
    • LoggerMapper
    • LogInfo
    • LogInfoExtensions
    • LogLevels
    • LogSettings
    • LogSource
    • LogSourceExtensions
    • NullLogger
  • Dapplo.Log.LogFile
    • FileLogger
    • ForwardingLogger
    • IFileLoggerConfiguration
  • Dapplo.Log.Loggers
    • ColorConsoleLogger
    • ConsoleLogger
    • DebugLogger
    • StringWriterLogger
    • TraceLogger
  • Dapplo.Log.XUnit
    • XUnitLogger

Class FileLogger

This implements a logger which writes to a log file in the background Filename and directory are configurable, also rolling filename and compression can be activated

Inheritance
System.Object
AbstractLogger
FileLogger
Inherited Members
AbstractLogger.Format(LogInfo, String, Object[])
AbstractLogger.LogLevel
AbstractLogger.UseShortSource
AbstractLogger.DateTimeFormat
AbstractLogger.LogLineFormat
AbstractLogger.IsLogLevelEnabled(LogLevels, LogSource)
AbstractLogger.ReplacedWith(ILogger)
AbstractLogger.WriteLine(LogInfo, String, Object[])
AbstractLogger.WriteLine(LogInfo, Exception, String, Object[])
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace:Dapplo.Log.LogFile
Assembly:Dapplo.Log.LogFile.dll
Syntax
public class FileLogger : AbstractLogger, ILogger, IDisposable, IFileLoggerConfiguration, ILoggerConfiguration

Constructors

| Improve this Doc View Source

FileLogger()

default Constructor which starts the background task

Declaration
public FileLogger()

Properties

| Improve this Doc View Source

ArchiveCompress

Compress the archive

Declaration
public bool ArchiveCompress { get; set; }
Property Value
Type Description
System.Boolean
Implements
IFileLoggerConfiguration.ArchiveCompress
| Improve this Doc View Source

ArchiveCount

The amount of archived files which are allowed. The oldest is removed.

Declaration
public int ArchiveCount { get; set; }
Property Value
Type Description
System.Int32
Implements
IFileLoggerConfiguration.ArchiveCount
| Improve this Doc View Source

ArchiveDirectoryPath

The path of the archived file

Declaration
public string ArchiveDirectoryPath { get; set; }
Property Value
Type Description
System.String
Implements
IFileLoggerConfiguration.ArchiveDirectoryPath
| Improve this Doc View Source

ArchiveExtension

The extension of archived file, default this is ".log.gz"

Declaration
public string ArchiveExtension { get; set; }
Property Value
Type Description
System.String
Implements
IFileLoggerConfiguration.ArchiveExtension
| Improve this Doc View Source

ArchiveFilenamePattern

Change the format for the archived filename

Declaration
public string ArchiveFilenamePattern { get; set; }
Property Value
Type Description
System.String
Implements
IFileLoggerConfiguration.ArchiveFilenamePattern
| Improve this Doc View Source

ArchiveHistory

The history of archived files, this could e.g. be stored in a configuration

Declaration
public IList<string> ArchiveHistory { get; set; }
Property Value
Type Description
System.Collections.Generic.IList<System.String>
Implements
IFileLoggerConfiguration.ArchiveHistory
| Improve this Doc View Source

DirectoryPath

Change the format for the filename, the possible arguments are documented in the . Environment variablen are also expanded.

Declaration
public string DirectoryPath { get; set; }
Property Value
Type Description
System.String
Implements
IFileLoggerConfiguration.DirectoryPath
| Improve this Doc View Source

Extension

The extension of log file, default this is ".log"

Declaration
public string Extension { get; set; }
Property Value
Type Description
System.String
Implements
IFileLoggerConfiguration.Extension
| Improve this Doc View Source

FilenamePattern

Change the format for the filename, as soon as the filename changes, the previous is archived.

Declaration
public string FilenamePattern { get; set; }
Property Value
Type Description
System.String
Implements
IFileLoggerConfiguration.FilenamePattern
| Improve this Doc View Source

MaxBufferSize

Limit the internal stringbuilder size,

Declaration
public int MaxBufferSize { get; set; }
Property Value
Type Description
System.Int32
Implements
IFileLoggerConfiguration.MaxBufferSize
| Improve this Doc View Source

Preformat

Setting this to true will format the message in the context of the write call. If this is set to false, the default, the formatting is done when writing to the file. First makes the call slower, last could introduce problems with UI owned objects.

Declaration
public bool Preformat { get; set; }
Property Value
Type Description
System.Boolean
Implements
IFileLoggerConfiguration.Preformat
| Improve this Doc View Source

Processname

Name of the application, if null it will be created

Declaration
public string Processname { get; set; }
Property Value
Type Description
System.String
Implements
IFileLoggerConfiguration.Processname
| Improve this Doc View Source

WriteInterval

Specify how long the background task can wait until it starts writing log entries

Declaration
public int WriteInterval { get; set; }
Property Value
Type Description
System.Int32
Implements
IFileLoggerConfiguration.WriteInterval

Methods

| Improve this Doc View Source

Configure(ILoggerConfiguration)

Configure this logger

Declaration
public override void Configure(ILoggerConfiguration configuration)
Parameters
Type Name Description
ILoggerConfiguration configuration
Overrides
AbstractLogger.Configure(ILoggerConfiguration)
| Improve this Doc View Source

Write(LogInfo, String, Object[])

Enqueue the current information so it can be written to the file, formatting is done later.. (improves performance for the UI) Preferably do NOT pass huge objects which need to be garbage collected

Declaration
public override void Write(LogInfo logInfo, string messageTemplate, params object[] logParameters)
Parameters
Type Name Description
LogInfo logInfo

LogInfo

System.String messageTemplate

string

System.Object[] logParameters

params

Overrides
AbstractLogger.Write(LogInfo, String, Object[])

Explicit Interface Implementations

| Improve this Doc View Source

IDisposable.Dispose()

Declaration
void IDisposable.Dispose()
Implements
System.IDisposable.Dispose()
  • Improve this Doc
  • View Source
Back to top Copyright © 2017 Dapplo