Engine logging
Sitecore Commerce keeps a separate log for each running Node. Sitecore Commerce supports the ability to have multiple instances (Nodes) running for a given deployment. An ID (GUID) is assigned to a Node instance when it is started, and is used in the naming of the log. For example, in IIS, you can increase the number of Worker Processes, which is currently set at one, to have multiple instances running at the same time for scale.
Sitecore Commerce keeps a separate log for each running Node. For example, a single log file would look like this:
SCF_Log_9bd1a92bd2e54e949c733feb94dd70e4.txt
The log "rolls" based on the life cycle of the Node. A new log will be generated when a Node starts up, and the log will end when the Node is shut down. A single log file would be a complete history of the activity of an individual Node. Under normal activity load, IIS will routinely cycle worker processes based on rules that are defined within the Site, which will cause the logs to refresh.
Logging is based on Microsoft.Extensions.Logging, and the logging tool provided in our sample is SeriLog.
By default, log files will log to the: wwwroot\logs
folder. This can be changed by altering the startup.cs
class which is provided as part of the Sitecore.Commerce.Engine
project. The following logging format is used:
{ThreadId} {Timestamp:HH:mm:ss} {ScLevel} {Message}{NewLine}{Exception}
This logging pattern is compatible with Sitecore Log Analyzer, and the resulting log files can be analyzed by that tool. Other SeriLog provided tags should also be able to be used, if desired.

Logging levels: the default logging information level that is logged is determined by how the Sitecore.Commerce.Engine
is started. The default options for starting the engine are managed in the project.json
file.
Option | Description | Results |
---|---|---|
web | The option used when hosted inside IIS. This is considered to be "production", and uses production settings. | Warn and above level are logged. |
dev | Used when launching directly in Visual Studio. | Information and above are logged |
load | Used when conducting load tests where minimal overhead is desired, but is not considered to be "production". | Warn and above level are logged |
Logging example: this logging pattern is compatible with Sitecore Log Analyzer, and the resulting log files can be analyzed by that tool. Other SeriLog provided tags should also be usable, if desired.
4 15:28:20 INFO Loading Global Environment using Filesystem Provider from: C:\Src\SitecoreCommerce\Sdk\Sitecore.Commerce.Engine\wwwroot s\Bootstrap\
4 15:28:20 INFO DataMessage:NodeStartup-GlobalEnvironmentFrom='Configuration: Global'
4 15:28:21 INFO DataMessage:NodeStartup-Status='Started',GlobalEnvironmentName='GlobalEnvironment'
4 15:28:33 INFO Instantiating "Sitecore.Framework.Caching.ConfigureSitecore"
4 15:28:33 INFO Invoking ConfigureServices on "Sitecore.Framework.Caching.ConfigureSitecore"
4 15:28:33 INFO Instantiating "Sitecore.Framework.Caching.Memory.ConfigureSitecore"
4 15:28:33 INFO Invoking ConfigureServices on "Sitecore.Framework.Caching.Memory.ConfigureSitecore"
4 15:28:33 INFO Instantiating "Sitecore.Framework.Logging.Serilog.ConfigureSitecore"
4 15:28:33 INFO Invoking ConfigureServices on "Sitecore.Framework.Logging.Serilog.ConfigureSitecore"
4 15:28:33 INFO Instantiating "Pipelines.ConfigureSitecore"
4 15:28:33 INFO Invoking ConfigureServices on "Pipelines.ConfigureSitecore"
4 15:28:33 INFO Configuring pipeline defaults
4 15:28:33 INFO Instantiating "Eventing.ConfigureSitecore"
4 15:28:33 INFO Invoking ConfigureServices on "Eventing.ConfigureSitecore"
4 15:28:33 INFO Configuring event defaults
4 15:28:33 INFO Instantiating "Sitecore.Commerce.Core.ConfigureSitecore"
4 15:28:34 INFO Invoking ConfigureServices on "Sitecore.Commerce.Core.ConfigureSitecore"
4 15:28:34 INFO Instantiating "Sitecore.Commerce.Plugin.DataProtection.ConfigureSitecore"
4 15:28:34 INFO Invoking ConfigureServices on "Sitecore.Commerce.Plugin.DataProtection.ConfigureSitecore"
4 15:28:34 INFO Instantiating "Sitecore.Commerce.Plugin.ManagedLists.ConfigureSitecore"
4 15:28:34 INFO Invoking ConfigureServices on "Sitecore.Commerce.Plugin.ManagedLists.ConfigureSitecore"
4 15:28:34 INFO Instantiating "Sitecore.Commerce.Plugin.Pricing.ConfigureSitecore"