Documentation forLoggly

JavaScript Logging

Loggly provides the infrastructure to aggregate and normalize log events so they are available to explore interactively, build visualizations, or create threshold-based alerting. In general, any method to send logs from a system or application to an external source can be adapted to send logs to Loggly. The following instructions provide one scenario for sending logs to Loggly.

You can send your Javascript logs to Loggly using our script loggly-jslogger. You can send both plaintext and JSON logs from any webpage. It’s also able to capture JavaScript errors from the window and send them to Loggly. For alternatives, please see the Advanced Options section.

JavaScript Logging Setup

1. Include the JavaScript tracker

Drop the following snippet into your web page, at the top or bottom

<script type="text/javascript" src="" async></script>
  var _LTracker = _LTracker || [];
    'logglyKey': 'TOKEN',
    'sendConsoleErrors' : true,
    'tag' : 'loggly-jslogger' 


Note: Setting ‘sendConsoleErrors’ to true will send all the unhandled errors to Loggly. It also leaves previously defined ‘window.onError’ functions. In case, you want to send unhandled errors during the page load, remove the aysnc attribute from the script tag and place the script tag at the top of your Web page.

2. Try Sending Logs

Send some test data using these examples.


_LTracker.push('Hello World'); 


  'text': 'Hello World',
  'aList': [9, 2, 5],
  'anObject': {
    'id': 1,
    'value': 'foobar'

3. Verify Events

Search Loggly for events for tag JavaScript.  If it doesn’t work, see the troubleshooting section below.


Loggly - JavaScript Docs Example

Advanced JavaScript Logging Options

  • GitHub or Bower – You can also host this library on your own site by copying the source, or fork it for your own needs
  • Proxy Setup – Setup proxy for Ad blockers.
  • Tracking Pixel – A tracking pixel if you can only do GET requests
  • Special Characters Support – Setting "useUtfEncoding" flag to "true" will prevent the Special Characters to being garbled on Loggly Search. You will be able to read and understand the included Special Characters in your log events more easily.
  • Search or post your own JavaScript logging service or how to log JavasScript questions in the community forum.

Troubleshooting JavaScript Logs

If you are having issues logging Javascript, and don’t see any data show up in the verification step, then check for these common problems.

Check script:

  • Wait a few minutes in case indexing needs to catch up
  • Open the developer tools console in your browser to verify the script is loaded and the _LTracker object is successfully initialized

Still Not Working?

  • Check if there are any Ad blockers are active on your browser.
  • Search or post your own questions for JavaScript logging and configuration around server side log messages, output, and more in the community forum.

The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.