Support Logging setup

                      JavaScript Logging

                      JavaScript Logging

                      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
                      • Loggly Libraries Catalog – New libraries are added to our catalog
                      • 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.
                      Thanks for the feedback! We'll use it to improve our support documentation.