Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Log Service Installation Instructions

Product version:

EPiServer CMS 5 SP1

Document version:

1.0

Document creation date:

07-06-2006

Document last saved:

12-01-2008

Introduction

The purpose of the Log Service is to centrally handle log messages in one place for the entire Web site. This document describes how to install the Log Service and includes information on how to troubleshoot the Log Service.

There are three logical parts in the log service:

  1. Web server or an application that generates the log messages
  2. Log Service to collect the log messages
  3. Analyzers to handle and present the log messages

Table of Contents

Installation Prerequisites

System Requirements

For the full installation with the base example analyzers, the log service has the same requirements as EPiServer CMS5 . The log service in the base form does not require a database, Web service or an EPiServer CMS 5 installation.

EPiServer CMS Modules

Log service also requires:

  • EPiServer CMS 5 R1 or later. This is needed to present the analyzer values.
  • EPiServer CMS Manager. This is used for a quick and easy installation.

Installing Log Service

Log service can be installed in one of two ways, either with EPiServer CMS Manager or manually. Instructions for how to install in both ways are described in this chapter.

Installing the Log Service with EPiServer CMS Manager

The log service is installed as a part of the EPiServer CMS installation, i.e. installing any version of EPiServer CMS 5 will also install the log service.

Installing the Log Service manually

Follow the instructions below to install the log service manually.

  1. If an older installation of the log service exists, uninstall this service according to the "Removing Log Service" chapter.

  2. Run the program installUtil.exe located in the .NET framework current version directory,
    e.g. "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe" with the Log Service binary as argument.
    c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe c:\inetpub\wwwroot\bin\EPiServer.LogService.exe

Configure the Log Service to Use a Database

Rename the default configuration file named EPiServer.LogService.exe.config.default (located in the installation directory under %programFiles%/EPiServer.LogService5) to EPiServer.LogService.exe.config.

To configure the log service with a database, the connection string in the configuration file (%programFiles%/EPiServer.LogService5/EPiServer.LogService.exe.config) must be changed. Change the value for the parameter connectionString to a connection string to an EPiServer database.

<configuration>

  <episerver.baseLibrary>

    <objectStores>

      <add type="EPiServer.Implementation.SqlObjectStore, EPiServer.Implementation" id="default">

       <parameter name="connectionString" value="Data Source=(local);Database=dbEPiServerDemo450RC3;User Id=usrEPiServerDemo450RC3;Password=password;Network Library=DBMSSOCN;" />

  

Enable Logging for an EPiServer CMS Installation

The logging configuration for an EPiServer CMS 5 installation is stored in the EPiServerLog.config file located in the installation's root folder. Two loggers are active by default: page access statistics and page publishing messages. These two loggers will store information about their respective areas in the database specified in the EPiServer.LogService.exe.config file.

Advanced
Logging in EPiServer CMS 5 is based on the log4net product and you can configure the logging behavior of your installation by modifying the configuration in the EPiServerLog.config file. Please visit the log4net site to find the full documentation about log4net and the structure of the configuration. The default configuration file contains the following configuration:

  • One appender with the following values: 
  1. type="EPiServer.Diagnostics.EPiServerUdpAppender, EPiServer"
  2. remoteAddress=<IP address to the log service>
  3. remotePort=<port defined for the log service, must be the same value as the udpClientPort property in the log service configuration file>
  4. encoding=Unicode (automatically added by the EPiServerUDPAppender)
  5. a layout that generates log messages on the form %d\t<siteid>\t%m
  • One logger on DEBUG level for the class EPiServer.DataAccess.PageSaveDB – to generate messages when a page is published.
  • One logger on INFO level for the class EPiServer.Util.PixelImg – to generate messages for the statistics.

Install Log Generator on an Existing Web Site

A component that generates a log message with a transparent .gif file for a Web page is available. The component generates a JavaScript, which in turn generates the path to the .gif file that generates the log message to the log service. 

<EPiServer:LogGenerator runat="server" ID="PixelImg" /> 

In the sample project this component is implemented in the default framework/master page, located in the file \templates\Public\MasterPages\MasterPage.master.

Installing the Log Service on a Web Farm

Only one log service is configured for all Web servers on a Web farm. For the sample analyzers, each Web server sends log messages to the log service over UDP and the log service publishes its results on a TCP/SOAP Web service that can be connected for all Web servers.

Architecture

Several Web servers can connect to one log service, but in normal case it is not recommended to use several log services to handle the messages.
  1. The Web servers are configured to send log messages to the log service in the EPiServerLog.config file located in the Web root for every Web server.
  2. Example for sending log messages to a remote log service:

      <appender name="UdpAppender" type="EPiServer.Diagnostics.EPiServerUdpAppender, EPiServer">

          <remoteAddress value="192.168.150.237" />

          <remotePort value="7070" />

          </appender>

     
  3. The example analyzers are configured to publish their information on a TCP/SOAP Web service. To publish this to a remote host, add the via attribute to the configuration in EPiServer.LogService.exe.config located in your EPiServer.LogService directory (normally %programFiles%\EPiServer.LogService5)

    Example configuration to publish the sample analyzer Time Span Analyzer over TCP/SOAP remote: 
     
  4. <view type="EPiServer.Log.Analyzer.TimeSpanAnalyzerView, EPiServer.Log.Analyzers"

       protocol="TCP/SOAP"

       endpoint="soap.tcp://localhost/TimeSpanAnalyzerView"

       via="soap.tcp://logservice.my.se/TimeSpanAnalyzerView "/>

     
  5. Change the SOAP proxy so that it connects to the remote server, the log service to connect to is specified by the logServiceUrl property in web.config.  In your own analyzers you must change it yourself by adding a via attribute to the endpoint.

    Example to add a via attribute to the time span analyzer's endpoint:
  6.    TimeSpanAnalyzerView client  =new TimeSpanAnalyzerView();

       Uri address = new Uri("soap.tcp://localhost/TimeSpanAnalyzerView");

       Uri via = EPiServer.Configuration.Settings.Instance.LogServiceUrl;

       client.Destination = new Microsoft.Web.Services2.Addressing.EndpointReference(address, via);

Removing Log Service

Follow the instructions below to remove the Log service.

  1. Stop the service at the command prompt with the command net stop EPiServer.LogService.
  2. Run the program installUtil.exe located in the .NET framework current version directory (e.g. c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe ) with the arguments /u for uninstall and the binary for the log service %Program Files%\EPiServer.LogService5\EPiServer.LogService.exe
    E.g.:
    c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe /u c:\Program Files\EPiServer.LogService5\EPiServer.LogService.exe
  3. Remove the directory %ProgramFiles%\EPiServer.LogService.
  4. Remove the configuration file for logging on the Web server EPiServerLog.Config, which exists in the Web server root directory.

    Advanced:
  • To remove all logging sent to the Log Service, remove the appender that sends UDP messages (default is EPiServerUDPAppender).
  • To remove the logging for published pages, remove the logger for the class EPiServer.DataAccess.PageSaveDB.
  • To remove the logging for statistics, remove the logger for the class EPiServer.Util.PixelImg.

Log Service Troubleshooting

The first page of the sample site reads “The log service could not be connected.”
or
The Statistics tab in Edit mode reads “Cannot connect to the log service.”
Cause: The log service cannot be connected by the Web service over TCP/SOAP.
Solution: Verify that the log service is started according to the "Validate that the Log Service is Functional" chapter.

The statistical values are not changing.
Cause: No log messages are generated/come over the UDP channel.
Solution: See the "Check the Log Configuration on the Web Server" chapter.

The Statistics tab in Edit mode reads “The log service is not configured with a database. Saved history will not be shown.”
Cause: The log service is not able to save data into the database.
Solution: See the "Check if the Log Service is Configured" chapter.

Solutions

Check if the Log Service is Installed

The installation directory (%Program files%/EPiServer.LogService5) should contain the executables and the configuration files for the log service. If it is empty, install the service according to the "Manual Installation" chapter.

Check the Log Configuration on the Web Server

Verify that the configuration file EPiServerLog.config exists in the Web server's root directory. In the sample project the file is named EPiServerLog.config.Default so it not will start logging automatically.

The configuration file must contain

  • A UDPappender whose remoteAdress property is the Log Service IP address. remotePort must be set to the same value as the Log Service configuration property udpClientPort and encoding  must be set to Unicode.
  • A logger called EPiServer.DataAccess.PageSaveDBT on DEBUG level, if the component for showing last published pages is to be used.
  • A logger called EPiServer.Util.PixelImg on INFO level, if you want statistics generation with transparent gif to work
  • A root logger, if you want a centralized logging for the whole Web site.

Check if the Log Service is Configured

The configuration file for the Log Service must be called EPiServer.LogService.exe.config and be located in the Log Service home directory (%Program files%\EPiServer.LogService.exe.config).

The log service is, by default, not started automatically when EPiServer is installed the file is called EPiServer.LogService.exe.config.Default.

Important configuration for the Log Service:

UDP port for log messages

<configuration>

  <appSettings>

    <add key="udpClientPort" value="7070" />

 

udpClientPort has to be the same value as the Web service log configuration remotePort for the UDPappender located in the file EPiServer.Log.Config.

Check if the Logging is Done with Transparent GIF

If there is a reference to the transparent .gif file, there must also be a HTML tag on the page to be included in the statistics. This page should start with:

<img width='1' height='1' alt=''... 

This tag generates a transparent .gif file that sends log messages to the Log Service if it is present on the Web site.

The log message that is sent by the transparent .gif has the following looks like this:
2005-04-12 10:52:05,444 |mySite|Page|...

Log4net will not write to the log file if EPiServerLog.Config is corrupt. Test if the configuration is correct by creating a file appender that writes log messages directly to a file and changes the log level for the root logger to DEBUG. If no file is created, the EPiServerLog.Config is corrupt and has to be rewritten.

Validate that the Log Service is Functional

In the installation directory for the log service, the log server's own log file is located in %Program files%\EPiServer.LogService5\Logs\. If this file is not present, the initial error message is written to the Windows Event Handler on the local machine.

The Log Service log should look like below if the Log Service is started.
Starting Udp Server, listen to port 7070

Start up the Log Service in DEBUG Mode

  1. Open a command prompt and navigate to the root directory of the log service, normally %PROGRAMFILES%\EPiServer.LogService\
  2. Shout down the normal log service by entering the following command
    net stop EPiServer.LogService
  3. Start up EPiServer.LogService in DEBUG mode by entering the following command
    EPiServer.LogService DEBUG
  4. This start ups the log service and outputs debug messages to the console in DEBUG mode.
  5. To quit the log service, press ‘q’ followed by ENTER.

Appendix A

Log Service in an EPiServer 4.x - EPiServer CMS mixed environment

When you use an EPiServer.LogService in a mixed environment with an EPiServer 4 installation parallel with an EPiServer CMS 5 environment, you must change the port for one of the services. This is done by editing the configuration files for one of the installments.

Change the UDP port for sending log messages
This is done in the EPiServerLog.config file of your site (located in the root folder) by changing the remotePort value for the StatisticsUdpAppender.
Example:

<appender name="StatisticsUdpAppender"

          type="EPiServer.Diagnostics.EPiServerUdpAppender, EPiServer">

  <remoteAddress value="127.0.0.1" />

  <remotePort value="7071" />

</appender> 

Change the port for messages for the log service

This is done in the log service configuration file EPiServer.LogService.exe.config located in your %PROGRAMFILES%\EPiServer.LogService (alt. %PROGRAMFILES%\EPiServer.LogService5) folder by changing the value for the udpClientPort to the corresponding port to your site's web.config.
Example:

<appSettings>

  <add key="udpClientPort" value="7071" />

</appSettings> 

Change the log service port for the Web service

This is done by editing your EPiServer.LogService.exe.config by adding a default port for the soap.tcp transport layer.
Example, Adding a config section for WSE:

<configuration>

  <configSections>

    <section name="microsoft.web.services3"

      type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration,

        Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

   

    <section name="episerver.baseLibrary"

             allowDefinition="MachineToApplication"

             allowLocation="false"

             type="EPiServer.BaseLibrary.ConfigurationHandler,EPiServer.BaseLibrary" />

  </configSections>

</configuration> 

And then change the default port for the soap:tcp transport layer :

<microsoft.web.services3>

  <messaging>

    <transports>

      <add scheme="soap.tcp" >

        <defaultPort value="8082" />

      </add>

    </transports>

  </messaging>

</microsoft.web.services3> 

Change the port for messages in your sites web.config file
This is done by adding the same information as you wrote in the previous section - “Change the log service port for the Web service”, to the web.config of your site.