Ktor 2.1.3 Help

Development mode

Ktor provides a special mode targeted for development. This mode enables the following capabilities:

  • Auto-reload for reloading application classes without restarting the server.

  • Extended information for debugging pipelines (with stack traces).

  • Extended debugging information on a response page in a case of a 5** server error.

Enable development mode

You can enable development mode in different ways: in the application configuration file, using a dedicated system property, or environment variable.

Configuration file

To enable development mode in a configuration file, set the development option to true:

ktor { development = true }
ktor: development: true

The 'io.ktor.development' system property

The io.ktor.development system property allows you to enable development mode when running your application:

  • To run an application in development mode using IntelliJ IDEA, pass io.ktor.development with the -D flag to VM options:

    -Dio.ktor.development=true
  • If you run your application using a Gradle task, you can pass io.ktor.development to the applicationDefaultJvmArgs property in a build.gradle(.kts) file:

    application { applicationDefaultJvmArgs = listOf("-Dio.ktor.development=true") }
    application { applicationDefaultJvmArgs = ["-Dio.ktor.development=true"] }

The 'io.ktor.development' environment variable

To enable development mode for a Native client, use the io.ktor.development environment variable.

Last modified: 23 August 2022