Client Side API Logging
Note
This feature is not available in .NET Core based installation.
NCache Client Side API Logging is a diagnostic feature which logs all NCache API calls made by an application. This is a configurable logging mechanism that creates several log files. The purpose of API logging is to identify which API and the its sequences cause the problem, so that problem can be reproduced easily at user’s end. Client API logging saves appropriate overload of the method called along with key, data size, cache status, encryption and compression information.
Warning
API logging has a performance impact - it is recommended to enable logging only for diagnostic purposes.
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.
Configuring Client Side API Logging
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.
Enable API Logging
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" />
Time Before Logging Start
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" />
API Log Iterations
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" />
API Log Iteration Length
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" />
API Log Delay Between Iteration
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" />
Logger Thread Logging Interval
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 APIs 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 %NCHOME%\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.
See Also
NCache Log Viewer
NCache Monitor Logging
Performance Counters Logging
Email Notifications on NCache Events