Change an Application's Log Level

You might sometimes want to change the app's log level to change output in the browser console. For example, the default info log level for console messages may be useful during development stages, but once the app goes into production, you might want to reduce console output to only critical information.

  1. To change an application's log level:
    1. On the Web Apps tab in the Navigator, select your web app, then click the JSON tab to open the app-flow.json file. Alternatively, switch to the app's Source view and locate the app-flow.json file under webApps.
    2. Add the logConfig snippet to the file:
      "logConfig": {
        "level": "loglevel"
      },

      where loglevel can be warn, error, info, fine, or finer. For example:

      "logConfig": {
        "level": "error"
      },
      You can also use an expression. For example, if you've defined window.myConfig as a global variable, you can define the log level as:
      "logConfig": {
        "level": "{{window.myConfig?.VB_LOGCONFIG_LEVEL ? window.myConfig.VB_LOGCONFIG_LEVEL : 'error'}}"
      },

      where the log level is window.myConfig.VB_LOGCONFIG_LEVEL's value. If window.myConfig.VB_LOGCONFIG_LEVEL isn't defined, the log level is set as error.

  2. Run your app and view output in the browser's console.
  3. It's also possible to dynamically set the app's log level in your browser's current session to temporarily troubleshoot issues. You do this using the sessionStorage.setItem() call in your browser's console. Here's how to do this in Chrome:

    Note:

    This setting requires your application to be on JET 14.0.6 or higher. Check the Settings editor to make sure your app uses a supported version. Upgrade your app, if needed.
    1. Open Chrome DevTools.
    2. Click the Console tab.
    3. Enter the following command in the console:
      sessionStorage.setItem('ojet.logLevel', 'loglevel')
      where loglevel can be none (least verbose), info, warning, error, or log (most verbose). For example:
      sessionStorage.setItem('ojet.logLevel', 'error')
    4. Refresh your browser to view updated information in the console.
    5. To reset the log level for your browser's current session, enter sessionStorage.removeItem("ojet.logLevel") in the console, then refresh your browser.