Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

JSNLog

Security covered Maintenance fixes only 61 sites

This module integrates the JSNLog JavaScript library with Drupal. It allows JavaScript messages and errors to be captured and stored in Drupal's watchdog log, with options to configure logging behavior and filter messages.

Overview

This module implements the JSNLog library. And stores JavaScript messages in watchdog.

Installation

  • Prefered option: composer require drupal/jsnlog.
    • For the JSNLog javascript library add:
      {
        "type": "composer",
        "url": "https://asset-packagist.org"
      }
    • extend your libraries path under installer-path:
      "web/libraries/{$name}": [
        "type:drupal-library",
        "type:bower-asset",
        "type:npm-asset"
      ],
    • add installer-types under extra:
      "installer-types": ["bower-asset", "npm-asset"],
    • and finally:
      composer require bower-asset/jsnlog
  • Manually: Place the module in the modules folder.
    • Download JSNLog library from JSNLog and place the folder under webroot/libraries named jsnlog.
    • (Optional - for better output) Download WhichBrowser library from github and place the folder under webroot/libraries named whichbrowser.
  • Activate and visit settings page.

Options

  • Enable or disable it.
  • Choose logging type: if ajax, console or both.
  • Choose library type.
  • Debug level to save into watchdog.
  • User agent filter to log only specific browsers.
  • Include or exclude roles and or pages.

Usage

If a JavaScript error occurs. The event will trigger an ajax callback and the error will be listed in watchdog.

Troubleshoot

Be beware of your adblocker. This may block the JSNLog script if
aggregation is off, or you use the CDN option.

Custom error triggers

For your custom JavaScript you may want to use some other notifications from the JSNLog library.

JL().warn("warn message");
JL().info("info message");
JL().fatal("fatal message");

Depending on your debug level you configured. These messages will be tracked as well.

Drupal 9–11

Ask your assistant about JSNLog

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
May 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Slowing

Release Timeline

Releases

Version Type Core PHP Release date
8.x-1.4 Stable 9–11 Sep 9, 2024
8.x-1.3 Stable 9–10 Dec 21, 2023
8.x-1.2 Stable 8–10 May 17, 2023