couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <>
Subject Re: logging from views
Date Sun, 25 May 2008 22:10:00 GMT
On Sun, May 25, 2008 at 6:37 AM, Christopher Lenz <> wrote:
> There's already a simple (but incomplete) provision for logging from the
> view server: you print a JSON-encoded line such as the following to stdout:
>  {"log": "bla bla"}
> CouchDB will take that and write it to its own log output (at INFO level).
> The Javascript view server (share/server/main.js) uses this to log error
> messages. We could simply make this functionality available through a
> `log(message)` function that would be made available inside views.

I tried adding a simple function to main.js:

log = function(message) {
  print(toJSON({log: toJSON(message)}));

Assigning anything other than a string to the value of "log" was
throwing errors in CouchDB, but wrapping the message in toJSON() gives
the expected results in the couch.log. Thanks for the hint, Chris.

I'll post the complete patch to JIRA.

Chris Anderson

View raw message