AngularJS Logging

You can send your Angular JS logs to Loggly via HTTP/S. We have used the angular-loggly-logger library to send Angular JS logs to Loggly. You can also send Javascript objects or JSON data and we will automatically parse it for each searching. You can see alternatives in the Advance Options section.

AngularJS Logging Setup

  1. Install Angular Loggly Logger
  2. 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.

  3. Configuring the Loggly Module
  4. 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);


  5. Send Test Logs
  6. 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.

  7. Verify Events
  8. 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.


    AngularJS Logging

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.