log4javascript documentation
What it is
log4javascript is a JavaScript logging framework based on the Java logging framework log4j.
log4javascript implements a subset of log4j (primarily 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.
Features
- 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
PatternLayoutwhich 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)
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. I have no plans to make log4javascript work in this browser.
I would welcome any information about whether log4javascript works in other browsers (particularly Safari prior to version 1.3 and Konqueror prior to version 3.4.3).
Licence
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 differ in some key aspects, principally in the
implementation of Logger.