Logging with the settings in Logging.json

The ServerAPIs project > Logging > Logging.json or Logging.Development.json file contains 1) the log level of PowerServer; 2) the logs to display in the console window; 3) the logging of SQLs, sessions and transactions.

Settings in Logging.json file will take effect in the production environment (for example, when Web APIs is published and running in IIS, docker etc.). The default log level is warning.

Settings in Logging.Development.json file will take effect in the development environment (for example, when Web APIs is running from the SnapDevelop IDE or the PowerBuilder IDE). The default log level is information.

The event levels (in the order of severity) include Trace, Debug, Information, Warning, Error, Critical, and None. The level change can be made at runtime (no need to restart the server).

For example, if you do not want to output logs at the Information level (more detailed level), you can change the log level in the file from "Information" to "Error".

The following is a sample log:

2021-03-05 09:09:09,080 ERROR PowerServerApi.ServerApiController.LogMessage [0] - MESSAGE: RequestId: CE1A2E41-0C93-4ff9-80FB-F98B096D4176, 
ErrorMessage: The INSERT statement conflicted with the CHECK constraint "check_age". The conflict occurred in database "Qa_datawindow", table 
"dbo.t_update_forcheck", column 'age'.
The statement has been terminated.