How to emit console.log output when using javascript-lang for custom scripts?

Hi all -- I'd like to emit to stdout information within my custom .js
script (located in /elasticsearch/1.4.2/config/scripts/test.js).

I've tried both console.log and print (just a guess), but neither work:

"error": "ElasticsearchIllegalArgumentException[failed to execute script];
nested: EcmaError[ReferenceError: "console" is not defined.
(Script2.js#19)]; "
"error": "ElasticsearchIllegalArgumentException[failed to execute script];
nested: EcmaError[ReferenceError: "print" is not defined.
(Script1.js#19)]; "

Any way for me to hook into stdout to emit logging information this way?
Thanks very much.

Tim

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ea610adb-986c-4de2-a429-6fb03b45a640%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hello Tim ,

Its very much possible from groovy , by accessing the Elasticsearch logger
instance.
You should be able to do something similar for javascript too.
Some good folks from Elasticsearch has given a good documentation on it
against my issue.

import org.elasticsearch.common.logging.; *

*ESLogger logger=ESLoggerFactory.getLogger('myscript'); *

*logger.info http://logger.info('This is a log message'); *

LINK - Expose logger object in the scripts · Issue #9068 · elastic/elasticsearch · GitHub

Thanks
Vineeth Mohan,
Elasticsearch consultant,
qbox.io ( Elasticsearch service provider https://qbox.io/)

On Wed, Dec 24, 2014 at 12:13 AM, Tim Heckel timheckel@gmail.com wrote:

Hi all -- I'd like to emit to stdout information within my custom .js
script (located in /elasticsearch/1.4.2/config/scripts/test.js).

I've tried both console.log and print (just a guess), but neither work:

"error": "ElasticsearchIllegalArgumentException[failed to execute script];
nested: EcmaError[ReferenceError: "console" is not defined.
(Script2.js#19)]; "
"error": "ElasticsearchIllegalArgumentException[failed to execute script];
nested: EcmaError[ReferenceError: "print" is not defined.
(Script1.js#19)]; "

Any way for me to hook into stdout to emit logging information this way?
Thanks very much.

Tim

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/ea610adb-986c-4de2-a429-6fb03b45a640%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/ea610adb-986c-4de2-a429-6fb03b45a640%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5mbn3ZRGpCk2Ey3bnJ-JQMXyW_J8ObGHnL8ef3N7CG_7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.