You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gary Murphy <gl...@hilbertinc.com> on 2005/10/08 17:20:40 UTC

Logging from JavaScript

I wrote some Ajax-based code that will enable logging from JavaScript 
code to the logger of your choice.  I would like this to become part of 
the Apache Logging or Commons project if it has sufficient merit.  How 
would I approach getting in touch with the right people?  My friends, 
Dion Gilliard and Noel Bergman suggested these two Apache e-mails.

Here is a sample of the application JavaScript.  It's pretty much what 
you would expect:

var log = new Logger();

function init() {
    log.debug("Initializing 'searchForm:complete-field' autocomplete...");
      .
      .
      .
}

Given my appender, the output looks like:

-------------------------------------------------------------------------------
2005-Oct-05 07:24:10.236 Level(Debug) Host(phineas) Instance(phineas)
Application(AEntendre Ajax Blueprint) 
Component(org.aentendre.framework.ajax.LoggerServlet)
Initializing 'searchForm:complete-field' autocomplete...

Re: Logging from JavaScript

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Sat, 2005-10-08 at 14:02 -0700, Martin Cooper wrote:

<snip>

> and one on the server-side:
> 
> 4) Is this its own servlet on the server side, that would need to be
> configured for the web app? A Struts Action? Hooked into some other
> framework? I'm assuming it's Java-only, but that seems like a limitation.

IMHO to do this properly would mean creating a basic protocol
specification so that any compliant server could be used. would need to
think carefully about performance. alternative would be a bridging API
supplied dynamically by the server. 

sounds like a better fit for the proposed jakarta web components
sub-project. where did that particular idea get to?

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: Logging from JavaScript

Posted by Martin Cooper <mf...@gmail.com>.
I don't have an opinion from the Logging side of things, but from the
JavaScript side, I have a few comments:

1) I'd want to know which JavaScript toolkit your code is based on. If it's
not based on one of the two or three most prominent ones, then I wouldn't be
interested, since having more than one Ajax implementation in client side
apps is, um, less than optimal.

2) The example you provided below suggests that your JavaScript code is not
namespaced. I would definitely want to see that change before I'd be happy
seeing it come here.

3) It might make more sense for this to be an add-on to one of the leading
JavaScript toolkits, rather than looking at this from a server-side
perspective. The JavaScript would be just a few lines of code using any of
those, so you could also consider multiple implementations.

and one on the server-side:

4) Is this its own servlet on the server side, that would need to be
configured for the web app? A Struts Action? Hooked into some other
framework? I'm assuming it's Java-only, but that seems like a limitation.

My 2 cents...

--
Martin Cooper


On 10/8/05, Gary Murphy <gl...@hilbertinc.com> wrote:
>
> I wrote some Ajax-based code that will enable logging from JavaScript
> code to the logger of your choice. I would like this to become part of
> the Apache Logging or Commons project if it has sufficient merit. How
> would I approach getting in touch with the right people? My friends,
> Dion Gilliard and Noel Bergman suggested these two Apache e-mails.
>
> Here is a sample of the application JavaScript. It's pretty much what
> you would expect:
>
> var log = new Logger();
>
> function init() {
> log.debug("Initializing 'searchForm:complete-field' autocomplete...");
> .
> .
> .
> }
>
> Given my appender, the output looks like:
>
>
> -------------------------------------------------------------------------------
> 2005-Oct-05 07:24:10.236 Level(Debug) Host(phineas) Instance(phineas)
> Application(AEntendre Ajax Blueprint)
> Component(org.aentendre.framework.ajax.LoggerServlet)
> Initializing 'searchForm:complete-field' autocomplete...
>
>