Links
Comment on page

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:
Subscription Manager currently only supports logging to file.

Enable Logging

Logging for Subscription Manager is always enabled and does not require configuration.
Repeat these steps for any of the XMPro products (Application Designer, Data Stream Designer, Stream Hosts, and AI XMPro) - except Subscription Manager.
  1. 1.
    Navigate to the IIS location where the XMPro product has been installed.
  2. 2.
    Open the appsettings.json file.
  3. 3.
    Set enableLogging in the featureFlags object to true.
  4. 4.
    Save the file.
  5. 5.
    Restart the XMPro product service.
"xmpro": {
"appDesigner": {
"featureFlags": {
"enableLogging": true
}
}
}

Stream Hosts

The steps differ slightly for Stream Hosts:
  1. 1.
    Close or stop the Stream Host.
  2. 2.
    Navigate to the file location where the Stream Host has been installed.
  3. 3.
    Open the appsettings.json file.
  4. 4.
    Set enableLogging in the featureFlags object to true.
  5. 5.
    Save the file.
  6. 6.
    Restart or reopen the Stream Host.

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

  1. 1.
    Open the web.config file.
  2. 2.
    Add the Serilog keys to the appSettings element.
  3. 3.
    Save the file and restart the Subscription Manager service.
<appSettings>
<add key="serilog:using:File" value="Serilog.Sinks.File" />
<add key="serilog:using:Expressions" value="Serilog.Expressions" />
<add key="serilog:write-to:File.path" value="<path>" />
<add key="serilog:write-to:File.rollingInterval" value="<rollingInterval> " />
<add key="serilog:write-to:File.rollOnFileSizeLimit" value="true" />
<add key="serilog:write-to:File.outputTemplate" value="{Timestamp} [{Level}] ({Name}) Company: {Company} UserId: {UserId} {NewLine}{Message}{NewLine}{Exception}"/>
</appSettings>
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.

Other XMPro products

Repeat these steps for all the XMPro products except Subscription Manager: App Designer, Data Stream Designer, Stream Hosts, and AI XMPro.
  1. 1.
    Open the appsettings.json file.
  2. 2.
    Add the “File” Serilog configuration inside the WriteTo array.
  3. 3.
    Save the file and restart the XMPro product service or Stream Host.
{
"Serilog": {
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "<path>",
"rollingInterval": "<rollingInterval>",
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] {SourceContext} Company: {Company} User Id: {UserId} Message: {Message:lj}{NewLine}{Exception}"
}
}
]
}
}

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:
  1. 1.
    Open the appsettings.json file.
  2. 2.
    Add the “ApplicationInsights” Serilog configuration inside the WriteTo array.
  3. 3.
    Save the file and restart the XMPro product service or Stream Host.
{
"Serilog": {
"WriteTo": [
{
"Name": "ApplicationInsights",
"Args": {
"connectionString": "<connection string>",
"telemetryConverter": "Serilog.Sinks.ApplicationInsights.TelemetryConverters.TraceTelemetryConverter, Serilog.Sinks.ApplicationInsights"
}
}
]
}
}

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:
  1. 1.
    Set enableApplicationInsightsTelemetry in the featureFlags object to true - the same as you already did here for enableLogging.
  2. 2.
    Open the appsettings.json file.
  3. 3.
    Add the “ApplicationInsights” configuration.
  4. 4.
    Save the file and restart the XMPro product service or Stream Host.
{
"ApplicationInsights": {
"ConnectionString" : "InstrumentationKey=<Instrumentation Key here>";
}
}

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:
  1. 1.
    Open the appsettings.json file.
  2. 2.
    Determine the site parameter by checking here.
  3. 3.
    Get the endpoint/URL and port number by checking here.
  4. 4.
    Add the “DatadogLogs” Serilog configuration inside the WriteTo array.
  5. 5.
    Save the file and restart the XMPro product service or Stream Host.
{
"Serilog": {
"WriteTo": [
{
"Name": "DatadogLogs",
"Args": {
"apiKey": "<api key>",
"source": "<source>",
"host": "<host>",
"configuration": {
"url": "<url>",
"port": port
}
}
}
]
}
}