Sunday, November 20th, 2005

Ajaxian Commons Abstract Logging: Commons-Logging for JavaScript

Category: Fun, JavaScript, Library

We recently mentioned a log4js logging toolkit on the site.

There is another version of this at

And, others quickly mentioned their favorite logging engine for JavaScript (e.g. Safari lets you talk to the console via an api).

Enter: ACAL

The Ajaxian team has seen this kind of thing before, on the Java side.

For those that don’t know, a bunch of logging frameworks came up in Java, to give you more than just System.out.println().

We had LogKit, and then the big daddy, Log4J.

Sun and the JCP came around and tried to create a “standard” logging framework, java.logging.*, but by then it was too late.

With all of these options, you ended up with some components using one logging framework, and others using another.

So, what could we do?

They came up with Commons Logging, a meta framework that allowed you to write to one API, and plugin the particular logging engine separately.

We realised that we have the same problem in JavaScript now, with all of these logging frameworks, so we created Ajaxian Commons Abstract Logging.

This logging toolkit abstracts away the various logging frameworks so you never need to learn them, you can just learn out framework.

Dynamic Discovery of Logging Framework

The coolest feature of Ajaxian Commons Abstract Logging is how dynamic discovery works.

We quickly realised that having to download the logging files again and again was bad for performance, so we use XUL on Mozilla, and HTA on IE to use file storage. We then keep just ONE copy of each logging framework that you have used, and discover one instantly when things start up.

When you use XUL/HTA for these file system access the user gets asked for permission to access disk, but we figure that inconvenience is minor compared to the performance increase in keeping one framework.js file around. I think you would agree.

We are now considering where to donate this code. Maybe Mozilla? Maybe Dojo?

What do you think? :)

Posted by Dion Almaer at 8:33 pm

3.6 rating from 8 votes


Comments feed

But people hate commons logging!

Comment by Elliot — November 20, 2005


You are right! This post is some Sunday sarcasm. Ironically, you know that someone will probably implement it now!



Comment by Dion Almaer — November 20, 2005

Its incredible how many people really spend time on logging frameworks =)

Actually, I developed a mochikit logging > log4j bridge. You add log messages on the client and it ajaxes them back to the server, where they get sent through to log4j.

I kept that to myself, as it’s dumb…. but perhaps I should have started an apache project! I could be famous!

Comment by Elliot — November 20, 2005


Maybe we could join our two projects together! :) :)



Comment by Dion — November 20, 2005

Actually, I think that would be handy as it keeps all your logging in one place. Don’t have to check some javascript specific log and the log4j logs.

Time to get it into Apache! ;)

Comment by Rob — November 21, 2005

So far, most JS libraries don’t seem to be doing much logging. It would be useful for developers, so here’s hoping that if and when they do introduce logging, they all converge on a single library, just as Java libraries converged on log4j. Otherwise, Ajax developers will have 3 or 4 popup logging consoles hidden away, ready to spring up upon some random key combo. Or maybe a fate worse than that: a commons logger to deal with.

Comment by Michael Mahemoff — November 21, 2005

I’m very frightened! :)

Comment by Kevin Burton — November 24, 2005

Nice to hear about this, but would it be not better to combine all the energy to one usful API?
I already tried to contact the developer of but got no response.
So I started now at a different project.
Everybody is welcome to support my to get a version, which probably is worth for

Comment by Stephan Strittmatter — November 25, 2005

Leave a comment

You must be logged in to post a comment.