Install Sana Commerce Webshop on Web and Database Server

Open 'Install Sana Commerce Webshop on Web and Database Server' wizard, choose your solution and scenario to see more provider-related information.

Enable Logging

When troubles appear when running Sana Commerce on a production environment, it is important to check the error message to troubleshoot the problem. To be able to do this, logging can be enabled in Sana Commerce. Out of the box two logging methods are available: 
  • Logging in a log file; 
  • Sending log information by e-mail. 
Sana Commerce uses the Logging Application Block from Enterprise Library. This is a collection of generic reusable software components delivered by Microsoft. With this logging component it is possible to specify trace listeners in the 'web.config' file. Listeners are actually subscriptions of a log types.
 
Two default trace listeners are specified in the SC 'web.config' file: Email TraceListener and Rolling Flat File TraceListener. Email TraceListener sends log entries as e-mail messages while Rolling Flat File TraceListener writes log entries to a text file. It also can create a new log file based on the current date and time or when the file reaches a certain size.
 
 Lets see what properties do both trace listeners have:

Step 1: Open the 'Web.config' file of the 'Sana.Commerce.StarterSite' project in Visual Studio 2008.

Step 2: Locate the 'loggingConfiguration' configuration section.

This section specifies event information and the formatters and listeners for logging and tracing for the Profile Manager component. When 'tracingEnabled' attribute is set to 'true' it makes the logging functionality available.
 
We need the 'listeners' configuration section:
<listeners>
 <add toAddress="scdemo@sana-software.com" fromAddress="scdemo@sana-software.com"
  subjectLineStarter="" subjectLineEnder=""
  smtpPort="25" formatter="Text Formatter"
  listenerDataType="Sana.Utilities.Logging.SCEmailTraceListenerData, Sana.Core, Culture=neutral,PublicKeyToken=2b26dc7ce8e04e9f"
  traceOutputOptions="None"
  type="Sana.Utilities.Logging.SCEmailTraceListener, Sana.Core, Culture=neutral,PublicKeyToken=2b26dc7ce8e04e9f" name="Email"/>
 <add fileName="D:\development\VSTS\SANA Commerce\trace.log" rollSizeKB="10000"
timeStampPattern="yyyy-MM-dd" rollFileExistsBehavior="Overwrite" rollInterval="None"
formatter="Text Formatter" header="----------------------------------------"
footer="----------------------------------------"
listenerDataType=
"Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
traceOutputOptions="None" type=
"Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="FileTraceListener"/>
</listeners>
 
Here are the Email TraceListener properties which should be specified:
  • 'toAddress' property specifies the e-mail address on which the log entry will be sent. This is required;
  • 'fromAddress' specifies the e-mail address where the log entry originated; this address is shown in the 'From' field of the received e-mail. This is required;
  • 'SubjectLineStarter' is the subject line prefix. This is optional;
  • 'SubjectLineEnder' is the subject line suffix. This is optional;
  • 'smtpPort' is the SMTP port that receives e-mail messages. The default is '25'. This is optional;
  • 'formatter' is the formatter to use with this trace listener. It is selected from the drop-down list. The default is 'none'. This is optional;
  • 'listenerDataType' represents the configuration settings that describe the Email TraceListener;
  • 'traceOutputOptions' property is used by trace listeners to determine which options, or elements, should be included in the trace output. Possible values are: 'CallStack', 'DateTime', 'LogicalOperationStack', 'None', 'ProcessId', 'ThreadId', and ''Timestamp. The default is 'none'. This is optional;
  • 'type' specifies the link to the .NET type which implements the listener functionality;
  • 'name' is the name of the trace listener. The default is 'EmailTraceListener'. This is required.
Rolling Flat File TraceListener properties which should be specified:
  • 'fileName' property specifies the file which will store the tracing information and its destination;
  • 'rollSizeKB' property specifies the maximum size the file can reach, in Kilobytes, before it rolls over. This is optional;
  • 'timeStampPattern' specifies the date/time format that is appended to the new filename. This is required;
  • 'rollFileExistsBehavior' determines what occurs to an existing file when it rolls over. If you select 'Overwrite', then the existing file is overwritten. If you select 'Increment', the application block creates a new file and names it by incrementing the timestamp;
  • 'rollInterval' determines when the log file rolls over. You can select 'none' (the default), 'minute', 'hour', 'day', 'month', or 'year'. This is optional;
  • 'formatter' specifies the formatter which will be used with this trace listener. It is selected from the drop-down list. The default is 'none'. This is optional;
  • 'header' displays additional information contained in the file header. The default is '----------------------------------------'. This is optional;
  • 'footer' displays additional information contained in the file footer. The default is '----------------------------------------'. This is optional;
  • 'listenerDataType' represents the configuration settings that describe the Rolling Flat File TraceListener;
  • 'traceOutputOptions': as with Email TraceListener this this option is used to determine which options, or elements, should be included in the trace output. This is optional;
  • 'type' specifies the link to the .NET type which implements the listener functionality;
  • 'name' is the name of the trace listener. This is required;

Step 3: Now locate the 'formatters' configuration section:

<formatters>
    <add template="Timestamp: {timestamp(local)}&#xA;Message: {message}&#xA;
Category: {category}&#xA;Priority: {priority}&#xA;EventId: {eventid}&#xA;
Severity: {severity}&#xA;Title:{title}&#xA;Machine: {machine}&#xA;
Application Domain: {appDomain}&#xA;Process Id: {processId}&#xA;
Process Name: {processName}"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" name="Text Formatter"/>
</formatters>

'Template' attribute in the 'formatters' node section defines the look of the log message report by specifying the tokens which will display the log information. More information about tokens can be found in the 'Definitive Guide to the Microsoft Enterprise Library' book by Keenan Newton. 

More information about configuring the logging procedure can be found here: http://msdn.microsoft.com/en-us/library/dd139895.aspx  and here: http://www.davidhayden.com/blog/dave/archive/2006/02/15/2802.aspx. Additional information about different trace listeners and their properties is available here: http://msdn.microsoft.com/en-us/library/cc309262.aspx