Configure the log settings

You can configure the log settings of PowerServer Web APIs in the following files in the Logging folder under the compiled Web APIs.

  • log4net.xml: This file contains the logging settings for PowerServer. The "RollingFile" appender specifies the location, size, and backup of the log file, the "TraceAppender" appender specifies to generate the trace log, the "ConsoleAppender" appender specifies to print the logging information in the console and sets the font color of the logging information. For detailed syntax, refer to Apache Log4Net Manual.

    For example, if you set the following file path, the log file can be located here ServerAPIs\bin\Debug\net8.0\Logging\logs\powerserver.log.

    <file value="Logging/logs/powerserver.log" />
  • Logging.json or Logging.Development.json: This file specifies the log level (Trace, Debug, Information, Warning, Error, Critical, and None), what level of logging information will be printed in the API console, and what type of PowerServer information (SQL, transaction, and session) will be logged.

    Logging.json will take effect in the production environment (for example, when Web APIs is published and running in IIS, docker etc.); and the default log level is Warning. Logging.Development.json will take effect in the development environment (for example, when Web APIs is running from the SnapDevelop IDE or the PowerBuilder IDE); and the default log level is Warning.

    If you want to view detailed logs (for example, the activities of DataWindow operations) in the Web API console, you should set the PowerServer log level to "Debug" or "Trace" in Logging.Development.json, for example,

    "PowerServer": "Debug"

    If you want to get faster responses (but fewer log information in the Web API console), you should set the PowerServer log level to "Warning", "Error", or "Critical".