Log archive (API logs)

This article describes the general logs that are created by API calls.

Tracing

Every API provides the possibility to write trace logs. Trace log is turned on using the below xml in profile.config.

<PriceProvider> <CustomPriceProvider save-external-order-to-server-database="true" delete-old-trace-log-after-number-of-folder="30" trace-folder="F:\Signifikant\Log\APIXml\" delete-old-trace-log-after-number-of-folder="60" impersonation="true" domain="localhost" user-name="xyz" password="xyz" /> </PriceProvider>

The tracing will place two files for each call, one request and one response, in this location. Log files will be placed in sub folders per date and old log files will be deleted after 30 folders by default. Default value can be changed by using delete-old-trace-log-after-number-of-folder="30".

Files will be named according to this example:

Request_PlaceOrder_e1f540ea-f4f8-4e8e-a123-76d451d5dba8_28.xml Response_PlaceOrder_e1f540ea-f4f8-4e8e-a123-76d451d5dba8_28.xml

e1f540ea-f4f8-4e8e-a123-76d451d5dba8 is the GUID of the session. _28 is a counter which will be kept the same for request and respose.

The Request and Response log files will contain the exact content of the calls and responses in xml or json (depending on API). Response file will also contain a response time to measure time for other end point to reply.

 

Log Archive

In version 5.1 and later logs are also stored in a log archive database. Logs are available in the admin interface and requests and responses may be downloaded from the UI.

User interface

Admin page contains site information which presents a summary of the site and the api status. Site status is a traffic light, green, yellow, red, depending on database status and api behaviour. Site status will display error (red), warning (yellow) or OK (green).

Status

Criteria

Status

Criteria

Error

Database is not accessible or

Api responds with error too often (defined critical threshold) or

Api responds too slowly (defined critical threshold).

Warning

Api responds with error too often (defined warning threshold) or

Api responds too slowly (defined warning threshold).

OK

None of the above

A summary of api behaviour is presented, where yellow represents delayed responses and red represents failed api calls during a time span.

server.config

For the function to work properly the log database need to be configured in server.config.

<LogArchiveDatabase> <Enabled>true</Enabled> <DataBaseName>LogArchive</DataBaseName> <DataBaseServer>(local)</DataBaseServer> <UseSqlServerUser>false</UseSqlServerUser> <SqlServerUser>sqluser</SqlServerUser> <SqlServerPassword>sqlpassword</SqlServerPassword> </LogArchiveDatabase>

profile.config

Log archive settings options are defined in profile.config. In version 5.1.5 automatic trunkation of the log archive is introduced. Trunkation will occur at applicaiton start, which happens after publish or reset of IIS, or after 30000 requests, whichever happens first.

 

Call types are: GetPrice, GetAvailability, GetOrderHistory, ValidateOrder, PlaceOrder,

Default settings are: