log4javascript
A great logging/trace tool I have been using in my AJAX applications is log4javascript. Essentially, it is a JavaScript implementation of log4j, the defacto standard in Java logging. I cannot stress how much this has helped me knowing what is going on inside the code (especially given our framework is largely event-driven).