Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WSO2 - How to log from within Javascript mediator

I want to log from withing Javascript script mediator for debugging porpouses. It is quite annoying to have to add the message/variable value... to a context variable and use a log mediator in the sequence.

Is there a way to avoid this?

King Regards.

like image 450
fipries Avatar asked Oct 02 '13 10:10

fipries


2 Answers

You just need to get ServiceLog inside the script mediator and use it as follows:

<script language="js">
    var log = mc.getServiceLog();        
    log.info("Logging inside Script Mediator");
</script>
like image 75
Daniel Silva Avatar answered Sep 22 '22 05:09

Daniel Silva


You can use print(message/variable);. It will display the message/variable in the terminal.

like image 40
Sumedha Kodithuwakku Avatar answered Sep 20 '22 05:09

Sumedha Kodithuwakku