iShare Logging


Studio Logging

The name of the .log files and the type of logging in Studio is controlled by the log .config files in the D:\Astun\iShare\n.n\Studio folder. There are the following log config files:

  • L4NConsoleApp.config - for Workflow
  • L4NiShareDataSyncConsole.config - for Data Share
  • L4NStudio.config - for Studio

Appender Section

If you open these in a text editor you will see that these log files have an <appender> section which takes care of the name and location of the log file together with the process of rolling over files by size or date. In the example below when, the log file reaches 100000 (100KB) in size, a new file will be generated and a maximum of 1000 log files will be kept.

The "MaximumFileSize" value setting can be specified in MB rather than KB, e.g. value="1MB". Make sure that the "MaximumFileSize" and "MaxSizeRollBackups" values are suitable for your infrastructure, i.e. large and/or numerous log files could fill the hard drive potentially causing problems for iShare and other applications running on the server(s). Equally, having large log files may slow the read/write process during iShare logging, which could affect the speed of the application for end users.


<appender> section
   <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
      <param name="File" value="logs\Studio.log" />
      <param name="AppendToFile" value="true" />
      <param name="MaxSizeRollBackups" value="10" />
      <param name="MaximumFileSize" value="100000" />
      <param name="RollingStyle" value="Size" />
      <param name="StaticLogFileName" value="true" />
      <layout type="log4net.Layout.PatternLayout">
      <param name="ConversionPattern" value="%d %-5p %c %m%n" />
	  <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
      </layout>
    </appender>

The file suffixed .log will always be the current log file. Any log files which have been “rolled over” will be renamed LogfileName.n where n is an incrementing number with the largest number being the oldest log file.

ConsoleApp.Log file locked issue - Prior to version 5.4.10

If more than one instance of an application using log4net to log to the same file is running then all those after the first will not be able to write to the log and will throw an error e.g.

log4net:ERROR [RollingFileAppender] Unable to acquire lock on file [path to Studio]\logs\ConsoleApp.log. The process cannot access the file '[path to Studio]\logs\ConsoleApp.log' because it is being used by another process.

The lockingModel directive can be used in a log4net configuration file to stop the application locking a log file. As can be seen in the example below this needs to be added to the end of the <appender> section.

lockingModel
    <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
      ...
      <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    </appender>

In iShare versions 5.4.10 or later this line has been added to the configuration.

Logger Section

Following the <appender> section you will see various <logger> sections controlling the name, level and appender-ref for different areas e.g.

<logger> section
    <logger name="Studio">
      <level value="INFO" />
      <appender-ref ref="RollingFileAppender" />
    </logger>

The level value can be:

ALL | DEBUG | INFO | WARN | ERROR | FATAL | OFF

Where ALL is the most verbose down to OFF where no logging is performed.

iShare Maps Logging

The name of the .log files and the type of logging in iShareMaps is controlled by the log .config files in the D:\Astun\iShare\n.n\WebApps\Web and WebService folders. Each of these folders has a log4net.config file.

These log configuration files have multiple <appender> sections with different .log file names; followed by <logger> sections controlling the name, level and appender-ref for different areas.

Address Search

The logging of address searches is switched on by default and may be switched off by editing the log4net.config file which may be found in the \web folder.  Simply change the level value to "OFF" if you do not wish Address Searches to be logged.

AddressSearches
    <logger name="AddressSearches">
      <level value="INFO" />
      <appender-ref ref="AddressSearchAppender" />
    </logger>

The Address Search log is usually written to the iShareMaps.Address.Searches.log which may be found under \web\logs folder.

Date
Time
Logger Name
IP Address
Search criteria
2010-02-18
11:48:19,566
[AddressSearches]
172.17.253.228
,,98,,
2010-02-18
12:31:25,727
[AddressSearches]
172.17.253.228
,,5,,
2010-02-18
12:31:53,369
[AddressSearches]
172.17.253.228
,98,,
2010-02-18
15:39:27,053
[AddressSearches]
172.17.253.228
,,4,,

Switching between DEBUG or PRODUCTION Logging

For all of your L4N*.config (or log4net.config) files you should also have an equivalent *.config.DEBUG (maximum logging) and a *.config.PRODUCTION (minimum logging) files within your Web, WebService and Studio directories. These can be copied and renamed to *.config to vary the level of logging as required.

Debugging

For debugging purposes you would copy the *.config.DEBUG version. Once you have done this any subsequent logging will contain a greater level of detail. To refresh or update your logs simply refresh the iShare application within the browser. You can then view the isharemaps.all.log files within the e.g. D:\Astun\iShare\n.n\WebApps\Web\logs and WebService\logs folders. 
It is worth noting that you will possibly want to reduce your level of logging to a minimum once you have finished your investigations as this will reduce the iShare resources required for the application logging process.