Set up logging of incoming HTTP requests for .NET
You can set up logging of incoming HTTP requests in Creatio .NET.
Creatio lets you use the following logging types of incoming HTTP requests:
- standard logging
- extended logging
Standard logging of incoming HTTP requests
Standard logging lets you log incoming HTTP requests. The Request.log file in the Logs directory of the Creatio root directory stores standard logs.
To set up standard logging:
- Open the
appsettings.jsonconfiguration file in the Creatio root directory. - Move to the
Standardblock. Standard logging is enabled by default (theEnabledflag is set totrue). - Add HTTP response codes into the
StatusCodesflag. Creatio will log the requests that receive the specified response codes. If you turn on theEnabledflag and leave theStatusCodesflag empty, Creatio logs all incoming HTTP requests.
"RequestLogging": {
"Standard": {
"Enabled": true,
"StatusCodes": [ 200, 300, 302 ]
},
...
}
You can analyze the logs using the Log Parser Studio utility because the log format is similar to the IIS log format.
Extended logging for incoming HTTP requests
Extended logging lets you retrieve detailed information about logs for incoming HTTP requests. The ExtendedRequest.log file in the Logs directory of the Creatio root directory stores extended logs. Creatio saves data about the response body of an incoming HTTP request automatically when extended logging is turned on.
To set up extended logging:
-
Open the
appsettings.jsonconfiguration file in the Creatio root directory. -
Move to the
Extendedblock. Extended logging is turned off by default (theEnabledflag is set tofalse). -
Set the
Enabledflag totrueto turn on logging. -
If you want to retrieve information about the HTTP request body in the log, set the
LogRequestBodyflag totrue(falseby default). -
Set the size of the displayed request/response body (the first N bytes) in the
MaxBodySizeBytesflag.ImportantExtended logging affects performance if Creatio receives a large number of requests or you set a large value of the
MaxBodySizeBytesflag. -
Add HTTP response codes into the
StatusCodesflag. Creatio will log the requests that receive the specified response codes. If you turn on theEnabledflag and leave theStatusCodesflag empty, Creatio logs all incoming HTTP requests.
"RequestLogging": {
...,
"Extended": {
"Enabled": true,
"LogRequestBody": false,
"MaxBodySizeBytes": 500,
"StatusCodes": [ 400, 401, 403 ]
}
}
You can use standard and extended logging simultaneously with different values of the StatusCodes flag. If the StatusCodes flag values for standard and extended logging match, Creatio duplicates the logs for incoming HTTP requests in the Request.log and ExtendedRequest.log files with different details.