Thursday 21 October 2010

How to enable logging

Stadium3 uses a third party component 'log4net' for logging.  More details about this component can be found at:
http://logging.apache.org/log4net/

Stadium3 can be configured to log errors or information. Information logging provides stats on pages users have accessed.

It is a very powerful component, and  can be configured to log to the windows event log,  file,  an email address etc.
However because it is so powerful, setting it up and configuration is not very simple.  Below are the steps to follow
to get it working for Stadium3.

By default logging is turned off. In order to turn it on, follow below steps:
  1. Open web.config file, there is a log4Net section as shown below: <log4net>
        <appender name="InformationLog" type="log4net.Appender.FileAppender">
          <file type="log4net.Util.PatternString" value="Logs/InformationLog_%date{yyyyMMdd}.txt"/>
          <appendToFile value="true"/>
          <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%m%n"/>
          </layout>
          <filter type="log4net.Filter.LevelMatchFilter">
            <levelToMatch value="Off"/>
            <acceptOnMatch value="true"/>
          </filter>
          <filter type="log4net.Filter.DenyAllFilter"/>
        </appender>
        <appender name="InformationLogDatabase" type="log4net.Appender.AdoNetAppender">
          <bufferSize value="1"/>
          <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
          <connectionString value="Data Source=localhost\SqlServer2005;Initial Catalog=Northwind;User=xxx;Pwd=xxxxxxxx"/>
          <commandText value="INSERT INTO EventLog ([Application],[Page],[User],[Details],[LogType]) VALUES (@application,@page,@user,@details,@logtype)"/>
          <parameter>....</parameter>
          <filter type="log4net.Filter.LevelMatchFilter">
            <levelToMatch value="Off"/>
            <acceptOnMatch value="true"/>
          </filter>
          <filter type="log4net.Filter.DenyAllFilter"/>
        </appender>
        <root>
          <appender-ref ref="InformationLog"/>
        </root>
      </log4net>

  2. You can configure to log to  a file or database.  Appender 'InformationLog' logs to a file and 'InformationLogDatabase'
    logs to a database. By default it is configured to log to a file.  This is indicated by element:   <root>
          <appender-ref ref="InformationLog"/>
       </root>

  3. By default logging is turned off, in order to turn it on, you have to change value of the appropriate appender's  <levelToMatch> node.

  4. You can change it to 'Info' for information logging or to 'Error' for error logging. An example of error logging will be: <filter type="log4net.Filter.LevelMatchFilter">
               <levelToMatch value="Error"/>
               <acceptOnMatch value="true"/>
     </filter>

  5. Files are created in a 'Logs' folder in 'StadiumServer' folder, first create this folder, then allow the neccessary user access to this folder, or give  'Everyone' access.

  6. If you want to log to database instead, change to following: <root>
            <appender-ref ref="InformationLogDatabase"/>
     </root>

  7. Errors or information will be logged to an EventLog table, you can configure the database as part of the connectionstring element:  <connectionString value="Data Source=localhost\SqlServer2005;Initial Catalog=Northwind;User=xxx;Pwd=xxxxxxxx"/>

  8. You need to run below script to create this table:
    CREATE TABLE [dbo].[EventLog](
     [ID] [int] IDENTITY(1,1) NOT NULL,
     [Application] [varchar](50) NULL,
     [Page] [varchar](50) NULL,
     [Date] [datetime] NOT NULL DEFAULT (getdate()),
     [User] [varchar](50) NULL,
     [EventType] [varchar](50) NULL,
     [LogType] [varchar](50) NULL,
    [Details] varchar(2000) NULL,
    [Link] varchar(2048) NULL,
     CONSTRAINT [PK_EventLog] PRIMARY KEY CLUSTERED
    (
     [ID] ASC
    ) ON [PRIMARY]
    ) ON [PRIMARY]

  9. Then change the 'InformationLogDatabase' appender's LevelToMatch tag to 'Error' or 'Info'.

Thursday 7 October 2010

Stadium3 Release : 3.1.1659.3550

Build 3.1.1659.3550 is available for download on Storytracker.

Only one new feature:
  • Reloading of application now only takes place when .sap file is uploaded
What this means:
Previously, we were reloading the application whenever the menu item associated with the application was clicked.
This meant if you changed the .sap file, copied it to the right location, any changes you made were immediately reflected  when the application's menu item was clicked.

This behaviour has changed. The .sap file has to be uploaded via Stadium3's web front end before any changes are reflected.
Reason for change:Reloading the sap file everytime user clicks on application's menu item is unneccessary, it only needs to be done if there are changes.
The application designer(user)  knows when there are changes and thus can make the decision when to upload. This results in significant performance gains.




Wednesday 6 October 2010

Stadium3 Release : 3.1.1657.3545

Build 3.1.1657.3545 is available for download on Storytracker.

New features include:
  • Fix for issue when merging user controls
  • Fix for issue with page parameter not appearing when page is not docked
  • Fix for issue when textbox and date fields are used in detailsview
  • Merge wizard now indicates changed and new entities
  • New CellBorderColour for DataGrid and Filter
  • New DisplayTitle property for Filter
  • New FieldHeaderFont property for DetailsView
  • DefaultPageNumber property of ImageViewer control now works with page parameters