Support Logging setup

                      AngularJS Logging

                      AngularJS Logging

                      You can send your AngularJS logs to Loggly via HTTP/S. For AngularJS 1.X, we have used the angular-loggly-logger library to send AngularJS logs to Loggly. You can also send Javascript objects or JSON data and we will automatically parse it for each searching. For Angular 2+, please see our post Angular Exception Logging Made Simple. You can see more alternatives in the Advance Options section below.

                      AngularJS Logging Setup

                      1. Install Angular Loggly Logger

                      Install the angular-loggly-library using in your current project using Bower.

                      bower install angular-loggly-logger --save

                      This will install the loggly logger module and its dependencies to your bower_components folder.

                      2. Configuring the Loggly Module

                      To send logs to Loggly, you need to configure the logglyLogger module by adding your customer token. As an example, you can create the file ExampleApp.js and put the following code inside it.

                      angular.module( 'ExampleApp', ['logglyLogger'] )
                      .config( function( LogglyLoggerProvider ) {
                      	LogglyLoggerProvider.inputToken( 'TOKEN' ).sendConsoleErrors(true);


                      3. Send Test Logs

                      You can send test logs by using the regular angular log handler $log. For example, you can create a controller to send a test log to Loggly by pasting this in the bottom of ExampleApp.js.

                      angular.module( 'ExampleApp')
                      .run( function( $log ) {
                      	$ 'Test Logs to Loggly' );

                      Create a web page and provide the ng-app directive to the html tag.

                      <html ng-app="ExampleApp" >

                      Open the page in your browser to run the code.

                      4. Verify Events

                      Search Loggly for events with the tag as angular over the past 20 minutes. It may take few minutes to index the event. If it doesn’t work, see the troubleshooting section below.


                      Advanced AngularJS Logging Options

                      AngularJS Log Troubleshooting

                      If you don’t see any data show up in the verification step, then check for these common problems.

                      • Wait a few minutes in case indexing needs to catch up
                      • Make sure you configured your customer token
                      • Open your developer tools for the browser, then the network tab, to make sure that the script is loaded, and that events are being sent to
                      • Search or post your own AngularJS error logging questions or others, such as logging client-side errors or enhancing AngularJS in the community forum.
                      Thanks for the feedback! We'll use it to improve our support documentation.