XLCubed is now FluenceXL. The new wiki can be found here: https://help.fluencexl.com/

Difference between revisions of "Logging"

(Rearrangement and documenting the Excel options)
Line 1: Line 1:
 
From XLCubed v10.0.150 it has become possible to capture logs from XLCubed activity.
 
From XLCubed v10.0.150 it has become possible to capture logs from XLCubed activity.
  
The logs for Excel and Web are configured using a JSON file called {{Code|appsettings.json}}.
+
== Configuration ==
* For the web this is deployed by default in the {{Code|/XLCubedWeb}} directory and will log to a file in the Logs sub-directory.
 
* For Excel this file should be created in the {{Code|%appdata%\XLCubed Ltd\XLCubed Excel Edition}} folder (you can type this address into File Explorer to go to the correct folder)
 
  
The log configuration can have different output targets which you can configure as shown below. You will have to restart Excel if you change the configuration.
+
The log configuration can have different output targets which you can configure as shown below.  
  
 
You can set the minimum logging level to restrict which events are logged. The following levels are available, from noisiest to quietest:
 
You can set the minimum logging level to restrict which events are logged. The following levels are available, from noisiest to quietest:
Line 14: Line 12:
 
* Error
 
* Error
 
* Fatal
 
* Fatal
 +
 +
=== Excel add-in ===
 +
You can enable logging in the add-in options:
 +
{{Menu|Options|XLCubed Options|User Interaction tab|Enable Logging}}
 +
 +
You will have to restart Excel if you change the configuration.
 +
 +
==== Manually enabling the Excel add-in log ====
 +
Create the {{Code|appsettings.json}} log configuration file in {{Code|%appdata%\XLCubed Ltd\XLCubed Excel Edition}} (you can type this address into File Explorer to go to the correct folder) then restart Excel.
 +
 +
=== Web ===
 +
By default, the {{Code|appsettings.json}} log configuration file is deployed in the {{Code|/XLCubedWeb}} installation directory, and will log to a file in the {{Code|Logs}} sub-directory.
  
 
== Sample configurations ==
 
== Sample configurations ==

Revision as of 09:01, 23 October 2023

From XLCubed v10.0.150 it has become possible to capture logs from XLCubed activity.

Configuration

The log configuration can have different output targets which you can configure as shown below.

You can set the minimum logging level to restrict which events are logged. The following levels are available, from noisiest to quietest:

  • Verbose
  • Debug
  • Information (the default)
  • Warning
  • Error
  • Fatal

Excel add-in

You can enable logging in the add-in options: Options > XLCubed Options > User Interaction tab > Enable Logging

You will have to restart Excel if you change the configuration.

Manually enabling the Excel add-in log

Create the appsettings.json log configuration file in %appdata%\XLCubed Ltd\XLCubed Excel Edition (you can type this address into File Explorer to go to the correct folder) then restart Excel.

Web

By default, the appsettings.json log configuration file is deployed in the /XLCubedWeb installation directory, and will log to a file in the Logs sub-directory.

Sample configurations

File logging

This will log Verbose messages to a file. Note that backslashes in the file path must be doubled.

{
 "Serilog": {
   "MinimumLevel": "Verbose",
   "WriteTo": [
     {
       "Name": "File",
       "Args": {
         "path": "C:\\Path\\To\\Logs\\error.log",
         "rollingInterval": "Day",
         "retainedFileCountLimit": 10,
         "restrictedToMinimumLevel": "Verbose"
       }
     }
   ]
 }
}

System Debug output stream

Alternatively, you can log to the debug output, which you can capture using DebugView a free tool from Microsoft. Note that this will have information from other programs running on the computer, so may be harder to interpret.

{
 "Serilog": {
   "MinimumLevel": "Verbose",
   "WriteTo": [
     { "Name": "Debug" }
   ]
 }
}

Microsoft Application Insights

You can enable Microsoft Application Insights by copying Serilog.Sinks.ApplicationInsights.dll and Microsoft.ApplicationInsights.dll into the installation folder (the bin folder for a web installation) and setting your appsettings.json to load them:

{
 "Serilog": {
   "Using": [
     "Serilog.Sinks.ApplicationInsights"
   ],
   "MinimumLevel": "Verbose",
   "WriteTo": [
     {
       "Name": "ApplicationInsights",
       "Args": {
         "telemetryConverter": "Serilog.Sinks.ApplicationInsights.TelemetryConverters.TraceTelemetryConverter, Serilog.Sinks.ApplicationInsights"
       }
     }
   ]
 }
}

The connectionString argument is optional if the Application Insights connection string has either been placed in a APPLICATIONINSIGHTS_CONNECTION_STRING environment variable or application setting, when using an App Service.

Note that depending on the exact version numbers, you may need to add assembly redirection:

<dependentAssembly>
 <assemblyIdentity name="Microsoft.ApplicationInsights" publicKeyToken="31bf3856ad364e35" culture="neutral" />
 <bindingRedirect oldVersion="0.0.0.0-2.21.0.429" newVersion="2.21.0.429" />
</dependentAssembly>