log4javascript 1.4 documentation

What it is

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

log4javascript implements a subset of log4j (primarily loggers, appenders and layouts) and has a few convenience methods of its own for quick JavaScript development. It can be used to debug JavaScript applications of all sizes, including Ajax applications.

If you just want to start using it, try the quickstart tutorial.


Who it's for

log4javascript is aimed at JavaScript developers.


Note on previous versions

Documentation for previous versions of log4javascript are not available here. However, documentation is bundled with every previous version, all of which are available to download.


  • can be initialized with one JavaScript include and one line of code;
  • by default logs to a pop-up console window with powerful search (including regular expression) and filtering features. This console window can also be used inline as an iframe in the main page;
  • can send log messages to the server via HTTP (Ajax, if you like);
  • highly configurable using familiar methods from log4j, including the powerful PatternLayout which gives the developer complete control over the format of the log messages.


Browser support

Fully supported browsers:

  • All versions Firefox back to 0.6
  • Other Mozilla-based browsers, as far back as Netscape 7
  • Internet Explorer 5 and higher for Windows
  • Safari 1.3 and higher (untested on earlier versions)
  • Opera 8.01 and higher (pre- version 9 browsers have a rendering bug related to scrolling that affects searching in PopUpAppender and InPageAppender)
  • Konqueror 3.4.3 and higher (untested on earlier versions)
  • Google Chrome

Partially supported browsers:

  • Older Mozilla-based browsers, e.g. Netscape 6.2 (generally OK except for display problems searching and filtering PopUpAppender and InPageAppender)
  • Opera 7.0 - 8.0 (InPageAppender not supported until version 7.5, plus some display problems searching PopUpAppender and InPageAppender. AjaxAppender not supported at all)

Unsupported browsers:

  • Internet Explorer for Mac. There are no plans to make log4javascript work in this browser.



log4javascript is licenced under the Apache License, Version 2.0. The Apache website has more details.


Further reading

In order to gain an understanding of the ideas behind log4j and therefore log4javascript, I highly recommend reading the short introduction to log4j from the log4j website. log4javascript borrows heavily from log4j but does not carry over all its concepts - for example, Filters and Renderers are not implemented.

The full log4javascript manual