Javascript Logging Frameworks - Ajax Patterns

Javascript Logging Frameworks

From Ajax Patterns

See also Javascript_Multipurpose_Frameworks, Ajax_Frameworks, and Logging pattern.

Contents

JSNLog

JSNLog

JSNLog is small (1.5kb) but full featured JavaScript logging library. It is optimized for running on the browser. It makes it easy to send log data to the web server, and to limit the amount of log data sent to save bandwidth and not overwelm the server.

If you use .Net, JSNLog has server side extensions that receive log data from the browser and have it logged on the server. And it lets you configure your loggers in your web.config.

Main features:

  • Single small JavaScript file (1.5kb);
  • Log4j type organization, with named loggers, severity levels, inheritance and appenders;
  • Filter by browser user agent (for example, log only when running on IE8);
  • Suppress all messages that match a regular expression;
  • Detect duplicate messages (such as produced in a loop) and suppress them;
  • Log trace messages in a browser side buffer, and only send them if there is a fatal message for an exception. Get all the data you need, but only when you need it;
  • Use Request ID to track what log data was produced for a given request;
  • Log objects as well as strings;
  • If log data is expensive to produce, only produce it if the logger is switched on.

Additional features if you use Microsoft .Net:

  • Receive log data on the server and pass it on to your server side logger, such as NLOG, Log4Net or Elmah;
  • Configure your loggers in your web.config.

loglevel

loglevel

loglevel is a lightweight, minimal and convenient JavaScript logging library which provides a reliable and extremely easy-to-use layer over the various console.log() methods that are often available, with none of their downsides. loglevel makes these methods safe to use by gracefully handling the cases where they don't exist, and also lets you filter the output of these, to only show messages at warn level or above, for example. This level is persisted in cookies (if available, safely handling non-browser environments too). loglevel doesn't try and go beyond this, instead just sticking to the core fundamentals of logging with no frills.

It supports AMD (i.e. RequireJS), CommonJS (i.e. Node.js), and direct usage (e.g. loading globally with a <script> tag) out of the box, and is designed to be extremely easy to quickly integrate with any other project to get core logging functionality available in any project with minimal hassle.

loglevel is distributed under the very liberal MIT licence.

log4javascript

log4javascript

log4javascript is a fully-featured, easy-to-use JavaScript logging framework based on the Java logging framework log4j. Its purpose is to provide JavaScript developers with a familiar, robust and flexible logging framework with which to debug JavaScript applications.

log4javascript's main features:

  • configured and ready for use in one script include and one line of JavaScript;
  • based on Java's log4j, implementing loggers, appenders, layouts and levels, providing a familiar interface;
  • powerful log console with severity filters, searching (including regular expression searches) and command line;
  • log console may be placed anywhere within your page or in a pop-up window;
  • flexible Ajax logger that posts log messages back to the server;
  • several layouts for flexible formatting of log messages, including XML, JSON, and Pattern layouts;
  • crunched and stub versions of the main .js file included in the distribution;
  • Standard, Lite and Production versions.

Since a major use of JavaScript logging is in browser testing, log4javascript is tested and works across all recent major browsers, including :

  • Internet Explorer 5+ for Windows
  • Mozilla, Firefox, Netscape
  • Google Chrome
  • Safari 1.3+
  • Opera 7.5+
  • WebKit
  • Konqueror 3.4+

log4javascript is distributed under the Apache License, Version 2.0.

JSLog

JSLog is a Javascript logging framework.

  • JSLog's focus is on ease of integration and deployment, providing a logging infrastructure with minimal performance impacts, and allowing you to easily "productionize" you code (even with the logging statements still included), by changing one configuration setting.
  • Open-source by Andre Lewis

Lumberjack

Lumberjack is a javascript logging framework that includes a sexy logging pane/console that stays at the bottom of the page. You can toggle the pane. Demo is right on the project page.

Log4Js

Log4js is a logging API for JavaScript. The main goal is to have a robust and solid logging API which is very simmilar to the Java logging API Log4j. There are several ways to log using "appender"s. The current available Appenders are:

  • DummyAppender: log nothing.
  • ConsoleAppender: open a new window in the browser or an inline div element and insert log messages in real time.
  • WindowsEventAppender: send log messages in the MS Windows event manager (Internet Explorer only).
  • FileAppender: write log messages in a local file on the client (IE and Mozilla).
  • AjaxAppender: allow to send log messages to a remote server with asynchronous HTTP request.
  • MetatagAppender: add log messages as meta data.
  • JavaScript Console Appenders for Opera, Mozilla and Safari

Many Appender can be used in a same time.

To format the logs there are several "Layout" implementations available.

Log4js is distributed under the Apache License, Version 2.0.

jsTracer

jsTracer jsTracer is a simple yet feature rich JavaScript logging and debugging tool. It is especially useful for debugging what has been coined "Web 2.0" code.

As the demand for increasingly complex JavaScript development rises with the appeal of "Web 2.0", I've been shocked to discover how few tools are available for the JavaScript developer. This is especially true of cross browser development.

jsTracer was written to help fill this void.


fvlogger

fvlogger This creates colorful logging lines which is great for distinguishing specific lines in a massive log file.


Blackbird

Blackbird - Open Source JavaScript Logging Utility

The code (blackbird.js, blackbird.css) and image assets (blackbird_panel.png, blackbird_icons.png) were created by G. Scott Olson.

The concept for Blackbird was sparked by JavaScript Logging, an article by David F. Miller (fvlogger). The first iteration of this project, named jsLogger, was developed for internal use at Orbitz. In the fall of 2007, jsLogger was rewritten from the ground up, given a facelift, and named project Blackbird.

Log Hound

Log Hound - Standalone multivector log mulcher

Log Hound is a standalone JavaScript logging utility that allows you to log messages during execution of JavaScript code. The log messages are stored and are viewable via the logging user interface which allows you to search the messages using multiple cooperative criteria. Log messages can be categorized by severity and by tags that can be associated with the messages when they are logged.