Set up logging
Example files for NLog are available in the Example folder which is available in the AlfabetWebApplication , AlfabetAPIServer , and Programs directory. The folders contain all or the relevant subset of the following examples for different use cases:
-
OnPrem: For customers with on premise installations and Bizzdesign BV Technical Consultants to maintain customer installations. The folder contains sub-folders for various use cases:
- File: For logging to file.
- FileCompressed: For logging directly to ZIP files.
- WindowsEventLog: For logging to the Windows event log.
- SAML: For logging to file when using SAML for user authentication.
- OAuth: For logging to file when using OAuth for user authentication.
- Demo: For partners and sales setting up an Alfabet instance for demonstration. NLog is pre-configured to write log messages about warnings and errors into a temporary folder.
- Cloud: For cloud installation via the BizzDesign cloud team. Includes logging to Splunk.
- Container: For internal tests of upcoming container installations.
- Services: For internal tests of upcoming service-based installations.
To implement logging:
- If not already available, create a directory config under the AlfabetWebApplication , AlfabetAPIServer , and Programs directory respectively.
- Copy the nlog-alfabet.config file from the relevant example configuration you want to use and paste it to the folder.
NLog configuration files are usually located in the working directory of a component and are named nlog.config . For the Alfabet Web Application and the Alfabet API server, the working directory contains an nlog.config file re-directing NLog to the config/nlog-alfabet.config file in the config sub-directory.
The file is overwritten on each update of a release.
You can use such a configuration to locate the configuration file in any other location the Alfabet components have ReadWrite access to. The nlog.config file in the working directory of the Alfabet component must then contain a link to the actual configuration file only:
- <nlog>
- <include file="..\nlog.config" />
- </nlog>
You can use the same central NLog configuration file for all Alfabet components.
If you changed the configuration file in the root directory of the Alfabet Web Application or the Alfabet API server, you need to store a copy outside the root directory and copy it back after each upgrade to a new Alfabet release.
- <nlog>
- Open the configuration file in a text editor and adapt the example configuration to your needs. Configuration consists of two phases:
- Configuration of the log target. In the examples, logging to file, console window, and windows event log is preconfigured. Most of the configuration elements are already included and only a few adaptions are required. Other configuration targets can be added following the documentation of the NLog component.
- Configuration of the rules for writing which log levels to which log targets. For Alfabet, you can define different rules for different activities, like, for example, overall activity of the Alfabet Web Application, execution of ADIF jobs, or execution of events. By default, writing log content to file is specified in the example files with additional logging of system messages to the console window. Changing the default configuration is optional.
- Save the file. The changes are immediately applied. You do not need to restart the Alfabet components.