Logging
Alfabet logging is based on the NLog® third-party component, providing flexible setup of logging. You can define templates for log messages in various formats like, for example, XML, CSV, or JSON, and specify the log target, which includes, for example, writing log messages to files, to the console window, or to the event log. Log messages can be written to different targets in parallel. You can additionally set up automatic sending of emails in case of errors. You can specify log target and log level for different functionality individually via rules.
NLog is easy to configure and changes to NLog configuration are taken over immediately without Alfabet server or Web server restart. If an issue occurs, the log level can be adapted without interruption of Alfabet availability to end users.
In addition to log messages, information about the environment of the started component, like host operating system and processor count is written to the log file at startup to ease support in case of issues.
The NLog component is highly adapted to modern deployment methods including cloud deployment, containerization and Linux support.
Example configurations are delivered with the release and adaptation of the examples to work in your environment is explained in the following. The example files include predefined configuration for logging to file, to the console window, to the Microsoft Windows® Event Log, and to Splunk®.
You can any time further customize the example configurations or define completely different log options following the configuration help provided with NLog.
Logging is activated automatically when a configuration file with a valid configuration is located in the correct folder.
Hints for NLog configuration:
- The configuration is case sensitive.
 - Parts of the values are defined via variables to specify a value only once and then use it in multiple configuration parts.
        
A variable is defined in an XML element variable. It consists of a unique name and a value.
- <variable name="UniqueName" value="DefinitionToBeRe-used"/>
 
Variables are included in values as ${var:VariableName}.
 - The configuration includes NLog specific layout renderers which return current environment data. Layout renderers are included in values as ${renderer name} , for example, ${processname} is substituted at runtime with the name of the logged process. An overview of layout renderers is available in the NLog documentation.