Configuration - Lethrir/NLogger GitHub Wiki
NLogger is configured in the App.Config or Web.config file, as appropriate for the project.
The following should be added to the configSections node:
<section name="nLogger" type="NLogger.NLoggerSection, NLogger" allowDefinition="Everywhere" allowLocation="true" />
An nLogger config section can then be added.
<nLogger logLevel="Info" failIfUnauthorized="true">
</nLogger>
The logLevel is defined in the LoggingLevel enum.
The failIfUnauthorized parameter is a boolean to indicate whether we should silently fail to log or throw an exception if there is a permissions issue trying to write to the log file.
The nLogger section should contain a child node to dictate whether to log to the Windows Event Log or to file.
<file path="C:\Logs\LogName.log" maxSize="100" maxFiles="3" incrementCurrent="true" />
The path attribute is the full path and file name for the initial log file. When the file is full, additional files will be created with .x appended, where x is the number of files created.
The maxSize is the max file size in KB a log may be written to. The logger will keep the latest log files, with a maxFiles used to define how many to keep.
incrementCurrent false makes the logger write to the .log file and older files becoming log.1, log.2 etc. If incrementCurrent is set to true, the log files will increment in number and the highest number will be the latest file.
<eventLog source="WorkerName" />