Configure Logging (Optional)
v4.3.0
Overview
Application logging refers to recording and storing information about the events and activities that occur within a software application. It involves capturing relevant data, such as error messages, warnings, user interactions, and system events, and storing them in a log file or database.
Application logging is essential for troubleshooting and debugging, as it helps identify and analyze issues that may arise during the application's execution. It also provides valuable insights into the application's performance, usage patterns, and security.
Serilog is the diagnostic logging library used in the XMPro suite, and the following logging outputs are supported:
Application Insights plus Telemetry (Added v4.3.6)
Subscription Manager currently only supports logging to file.
Enable Logging
From v4.4.4., logging for all products is always enabled and the feature flag does not need to be enabled. Lightweight logging to file is active by default and we recommend that it is reviewed.
Repeat these steps for any of the XMPro products (Application Designer, Data Stream Designer, and AI XMPro) - except Subscription Manager and Stream Hosts.
Navigate to the IIS location where the XMPro product has been installed.
Open the appsettings.json file.
Set
enableLogging
in thefeatureFlags
object to true.Save the file.
Restart the XMPro product service.
Logging to File
This utilizes the Serilog file sink. See Serilog sinks file documentation for a complete set of configuration options.
Below are examples for each XMPro Product.
Subscription Manager
Open the web.config file.
Add the Serilog keys to the
appSettings
element.Save the file and restart the Subscription Manager service.
It might be encrypted, which will require you to decrypt it first. For instructions, please refer to the How to encrypt and decrypt a web.config file Knowledge Base article.
Stream Hosts
Changed in v4.4.0
Using appsettings.json
Close or stop the Stream Host.
Navigate to the file location where the Stream Host has been installed.
Open the appsettings.json file.
Add the “File Logging" Serilog configuration.
Save the file and restart or reopen the Stream Host.
Using Environment Variables
This is the preferred approach for our Stream Host Docker Images (Linux). The environment variables will take precedence over the same configuration in the appsettings.json file.
Add the environment variables to the platform / service running the Stream Host.
Restart the Stream Host.
Other XMPro Products
Repeat these steps for all the XMPro products except Subscription Manager and Stream Hosts: App Designer, Data Stream Designer, and AI XMPro.
Open the appsettings.json file.
Add the “File” Serilog configuration inside the WriteTo array.
Save the file and restart the XMPro product service
The above example provides for the following:
Log files will now be added to the "Logs" folder located within the "App_Data" directory in the site's root folder.
Log files are stored in the "App_Data" folder because it is a protected directory in IIS, preventing access via direct web links. This ensures the security of the log data.
It rolls over to a new file daily, or when the file size exceeds 1MB (this helps to prevent large log files and also gives an easy way to calculate the maximum storage consumption when combined with the retention setting
It retains only the last 14 log files
File names will have the format log_{Date}.txt with an extra sequence number appended if it rolls over due to the size limit, for example:
log_20240321.txt
log_20240321_001.txt
log_20240321_002.txt
log_20240322.txt
Application Insights
This utilizes the Serilog application insights sink. See Serilog sinks file for Application Insights for a complete set of configuration options.
Below are the steps for an example of how it can be used in App Designer, Data Stream Designer, Stream Hosts, and AI XMPro:
Open the appsettings.json file.
Add the “ApplicationInsights” Serilog configuration inside the WriteTo array.
Save the file and restart the XMPro product service or Stream Host.
Application Insights plus Telemetry
This utilizes the Serilog application insights sink to write events to Microsoft Azure Application Insights and collect valuable Telemetry data.
Below are the steps for an example of how it can be used in App Designer, Data Stream Designer, Stream Hosts, and AI XMPro:
Set
enableApplicationInsightsTelemetry
in thefeatureFlags
object to true - the same as you already did here forenableLogging
.Open the appsettings.json file.
Add the “ApplicationInsights” configuration.
Save the file and restart the XMPro product service or Stream Host.
Datadog
This utilizes the Serilog datadog sink. See Serilog Sinks File for Datadog for a complete set of configuration options.
Below are the steps for an example of how it can be used in App Designer, Data Stream Designer, Stream Hosts, and AI:
Open the appsettings.json file.
Determine the site parameter by checking here.
Get the endpoint/URL and port number by checking here.
Add the “DatadogLogs” Serilog configuration inside the WriteTo array.
Save the file and restart the XMPro product service or Stream Host.
Last updated