Logging is an important tool that can be used to keep a record of all occurrences that take place in a distributed application along with their respective time stamps. NCache provides just such a facility that can be used to record API calls on the client side of the application in the form of log files.
This feature can be enabled to create a detailed, sequential log of NCache API calls made from the client side. This is a no code change option and is enabled by simply changing the configuration properties of your project.
The log file data can be of great use to NCache users as well the Alachisoft technical support team. The information in the log file can be used as a trace mechanism to understand and investigate problematic situations that might arise in the client side NCache API calls.
To enable and configure client side API logging, following properties need to be added in the application's configuration file which can be app.config or web.config depending on your application type. These settings are to be added under the
<configuration> and the
<appSettings> tags. The following properties need to be added in order to enable API logging for NCache API calls. Please make sure that you have added Web.dll in your project.
This is the first value that needs to be added in the configuration. This attribute tells the application whether to enable or disable the client side API logging feature. Set the value to true in order to enable logging feature in the application.
<add key="CacheClient.EnableAPILogging" value="true" />
After enabling the API call logging feature, you need to set the time for which the process waits before logging the API calls. This time span is given in hh:mm:ss format, which means that it is the time that the process waits before the first iteration begins. In the following example, the application will start recording logs as soon as the application starts:
<add key="CacheClient.TimeBeforeLoggingStart" value="00:00:00" />
You also need to specify the number of times the application can log the data via
APILogIterations feature. NCache will only let you maintain logs for the specified number of iterations.
<add key="CacheClient.APILogIterations" value="4" />
This property specifies the length of one log iteration in seconds. For example, the following code will specify that each log will be recorded continuously for one hour before a break occurs:
<add key="CacheClient.APILogIterationLength" value="3600" />
This property sets the time interval between two consecutive iterations of API call logging for NCache clients. This time interval is set in seconds.
<add key="CacheClient.APILogDelayBetweenIteration" value="5" />
This is the time span after logging iteration at which the logging data will be written on to the log file.
<add key="CacheClient.LoggerThreadLoggingInterval" value="5" />
Based on the settings specified above NCache will start logging the API's used in your application. If there is ever a situation where an issue arises and might be related to NCache, this log is another step closer to identifying the root of the problem. The log file created as a result of the feature is located at
%install folder% NCache\log-files. A new folder is created once the application has finished logging by the name APIUsageLogs. All API log files will be created in the above mentioned folder, the log file name is created using the name of the cache being used and also the time stamp at which the file was created.
What to Do Next?