Changing the Log Level of a Running App Instance

When starting an app, you can set the log level for the app by using the FLOGO_LOG_LEVEL environment variable. For more information, see FLOGO_LOG_LEVEL.

After the app starts, to change the log level of the running app instance without restarting the app, you can use the GET and PUT curl commands. You can perform the operations on the console or use an application such as Postman.

The Content-Type is always application/json, even if you have specified another Content-Type.

When the log level is changed, a message is displayed on the console.

Example

  1. Start the app as follows:
    FLOGO_HTTP_SERVICE_PORT=<port> FLOGO_LOG_LEVEL=<log_level> ./<app_name>
  2. To get and display the log level on the console, use the GET curl command as follows:
  3. curl -i -X GET http://localhost:7777/app/logger

    HTTP/1.1 200 OK

    Content-Type: application/json

    Date: Wed, 18 Aug 2021 00:17:57 GMT

    Content-Length: 17

    {"level":"INFO"}

  4. To change the log level, use the PUT curl command as follows:
  5. curl -i -X PUT -H "Content-Type: application/json" -d '{"level":"DEBUG"}' http://localhost:7777/app/logger

    HTTP/1.1 200 OK

    Content-Type: application/json

    Date: Wed, 18 Aug 2021 00:19:05 GMT

    Content-Length: 35

    {"msg":"Log level set to 'DEBUG'"}