Welcome to Devintelligence.com Sign in | Join | Help

.Net Adventures

In .Net we trust
Error!
HTTP/1.1 404 Not Found


The Logging Framework for JS

I like log4net .The library is very easy for using and configuration and has an amazing set of features. I found an interesting project that allow to ASP.NET(AJAX) developers to add logging abilities to JavaScript .The project called log4js .It's free and can be downloaded at this link.The main aim of framework is to be very similar to the Net logging framework Log4net.So if you used log4net before you may try log4js.

The log4js contains following appenders:

  • 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).
  • MetatagAppender: add log messages as meta data.

The configuration is done by inserting :

<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 AJAX Appender to write the log to
logger.addAppender(new AjaxAppender("./log4j.jsp"));
// --> </script>

Log4js is compatible with almost all current browsers (IE,Firefox,Safari,Opera...)

Technorati Tags: ,,
Posted: Monday, January 28, 2008 10:32 PM by admin
Filed under: , ,

Comments

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# January 28, 2008 2:46 PM

Hosam Kamel said:

A small article explains the uses of&#160; log4js which is a free library similar to the Net logging

# January 29, 2008 1:21 AM

Richard's Rant said:

My apologies for the lack of posts. It was Australia Day, and I took a few days off So without any further

# January 29, 2008 3:21 AM
New Comments to this post are disabled