JavaScript loggers

JSLog - a Lightweight Ajax logger

Ajax development is easier when you have a logging system like this:

  • convenient: always a click away ;
  • asynchronous: no need to acknowledge each message ;
  • can be turned on or off globally with a simple config change ;
  • easy to use: just include one .js on your page ;
  • stays in your code throughout development and deployment ;
  • lightweight: just over 6 Kb & places just two tokens into the namespace ;
  • framework agnostic: Like Prototype? Mochikit? Rico? Dojo? JSLog works with all of them!

 

<!--googleAd--> Log4js - The Logging API for JavaScript

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.

Severals ways to log

The current available Appenders are:

  • WindowAppender: open a new window in the browser and insert log messages in real time.
  • WindowsEventAppender: send log messages in the MS Windows event manager.
  • FileAppender: write log messages in a local file on the client.
  • AjaxAppender: allow to send log messages to the server with asynchronous HTTP request. There you can process the logging events like you want on server side (ASP.NET, Java Servlet, JSP, PHP, Ruby, etc.).
  • MetatagAppender: add log messages as meta data.

Many Appender can be used in same time.


Usage

Log4js is a simple API, which could be included in your scripts:

 
<script src="log4js.js" type="text/javascript"></script>
<script type="text/javascript">
<!-- //
//initialize the logger with your category
var logger = Log4js.getLogger("ajaxTest");
//set the level of logging
logger.setLevel(Log4js.Level.ALL);
//set the Appender to write the log to
logger.addAppender(new AjaxAppender(logger, "./log4j.jsp"));
// --> </script>

Now you can call the log in your logic like follow line:

 
<input type="button" name="trace" value="Trace"
onclick="logger.trace('I was traced!');return false;" />

For more details have a look at the users guide.

 

log4javascript

log4javascript is a JavaScript logging framework based on the Java logging framework log4j.

Enhancements in 1.3 include:

  • Fully tested and supported in IE 7;
  • Firebug logging support;
  • Facility to log JavaScript objects;
  • Compressed (30% smaller) version of main file included in distribution;
  • Drop-in stub version included, allowing you to replace log4javascript.js with a lightweight JavaScript file in production environments without having to modify any code;
  • Pop-up / in-page console search now allows optional filtering to show only matching log entries, highlighting of all search matches and navigation buttons to cycle through the search results;
  • Pop-up console can now optionally open a new window automatically at the time of the next log entry after the original window was closed;
  • Pop-up / in-page console can optionally have a limit on the number of messages that are displayed and stored, thereby preventing potential sluggishness and excessive memory use. When this limit is reached, each new log entry will cause the oldest entry to be discarded;
  • Exceptions (and optionally stack traces in Firefox) passed into logging methods are now displayed;
  • Improved demos and examples.
MochiKit.Logging steals some ideas from Python's logging module [1], but completely forgot about the Java [2] inspiration. This is a KISS module for logging that provides enough flexibility to do just about anything via listeners, but without all the cruft.

As of MochiKit 1.3, the default logger will log all messages to your browser's native console. This is currently supported in Safari, Opera 9, and Firefox when the FireBug extension is installed. MochiKit 1.4 adds support for the relevant APIs for Internet Explorer (the Debugger and the Atlas framework, see here).

Yahoo! UI Library: Logger

The Logger Control provides a simple way to read or write log messages with a single line of code. With this control, you can tap into the rich event-driven messages included with the YUI Library's debug files; This messaging allows you to get a fuller picture of the inner workings of any YUI Library component. The Logger Control provides a simple messaging interface that allows you to filter, pause, resume, and clear log messages on your screen. Whether or not you invoke this UI, you can monitor log output via the FireBug extension for Firefox or via the Safari JavaScript console. The Logger Control supports logging messages with customizable categories and sources. Adventurous developers can extend Logger to build their own implementations to suit any requirement.

 

JavaScript Debug Logger

 

 

Comments

Are you human

You can use simple HTML-formatting tags(like <b>, <ul>, <code> and others)

Wow free space!
Super hosting provider might be here!

Is it Google?