How to set up the backend log to output the executed SQL

When you need to debug a problem, you can temporarily set a higher log level to output more information. For more, refer to Logging with the settings in Logging.json and Configure log settings.

For example:

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 warning.

You can change "PowerServer": "Warning" to "PowerServer": "Debug" to output more details including the SQL related logs, session status changes and transaction status changes.

{
  "Logging": {
    // Sets whether to enable file server for logging
    "EnableFileServer": true,

    // Sets the output of the log in the console
    "Console": {
      "LogLevel": {
        // Sets the PowerServer log output level
        "PowerServer": "Debug"
      }
    }
  },
  "PowerServer": {
    // Sets the PowerServer debug-related log options
    "LoggingOptions": {

      // Sets whether to output SQL related logs
      "EnableSqlLog": true,

      // Sets whether to output logs related with session status changes
      "EnableSessionLog": true,

      // Sets whether to output logs related with transaction status changes
      "EnableTransactionLog": true
    }
  }
}