Comment on page
Configure Logging (Optional)
v4.3.0
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.
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.Navigate to the IIS location where the XMPro product has been installed.
- 2.Open the appsettings.json file.
- 3.Set
enableLogging
in thefeatureFlags
object to true. - 4.Save the file.
- 5.Restart the XMPro product service.
"xmpro": {
"appDesigner": {
"featureFlags": {
"enableLogging": true
}
}
}
The steps differ slightly for Stream Hosts:
- 1.Close or stop the Stream Host.
- 2.Navigate to the file location where the Stream Host has been installed.
- 3.Open the appsettings.json file.
- 4.Set
enableLogging
in thefeatureFlags
object to true. - 5.Save the file.
- 6.Restart or reopen the Stream Host.
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.
- 1.Open the web.config file.
- 2.Add the Serilog keys to the
appSettings
element. - 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.
Repeat these steps for all the XMPro products except Subscription Manager: App Designer, Data Stream Designer, Stream Hosts, and AI XMPro.
- 1.Open the appsettings.json file.
- 2.Add the “File” Serilog configuration inside the WriteTo array.
- 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}"
}
}
]
}
}
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.Open the appsettings.json file.
- 2.Add the “ApplicationInsights” Serilog configuration inside the WriteTo array.
- 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"
}
}
]
}
}
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.Set
enableApplicationInsightsTelemetry
in thefeatureFlags
object to true - the same as you already did here forenableLogging
. - 2.Open the appsettings.json file.
- 3.Add the “ApplicationInsights” configuration.
- 4.Save the file and restart the XMPro product service or Stream Host.
{
"ApplicationInsights": {
"ConnectionString" : "InstrumentationKey=<Instrumentation Key here>";
}
}
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:
{
"Serilog": {
"WriteTo": [
{
"Name": "DatadogLogs",
"Args": {
"apiKey": "<api key>",
"source": "<source>",
"host": "<host>",
"configuration": {
"url": "<url>",
"port": port
}
}
}
]
}
}
Last modified 1mo ago