Logging from Javascript

Recently, I have been thinking about how to handle logging events from Javascript. I have done with with an HTML TextArea on the page, I have seen things that pop up a floating window or frame and write messages to that, but, it occurred to me that one could, pretty easily, write a servlet to accept log messages via HTML “get” (or “post”) and then use log4j (or any logger) to log them in whatever whatever way you normally log events with your application. To get the log messages to this servlet just use AJAX (XMLHttpRequest) (you can just ignore the response). I will have to write something like this.

Leave a Reply