Skip to main content

Posts

Showing posts from May, 2016

Logging parameters in WSO2 ESB Script mediator

Script mediator is helpful in many ways and it can be written in different scripting languages such as JavaScript, Groovy and Ruby. I'm going t o use JavaScript for this example. I'm trying to show you the way that you can use to log some values when you are writing a mediator. This will be helpful when you need to log values when you are writing a complex script mediators. This is a sample script <script language= "js" > var log = mc.getServiceLog(); log.info( "started" ); var temp_auth = mc.getProperty('authheader'); log.info( "temp_auth : " + temp_auth); log.info( "out" ); </script> When you define a " var log = mc.getServiceLog();" variable, you can use log object to display values as below. log.info( "started" ); log.info( "temp_auth : " + temp_auth); This is a sample proxy service <?xml version= "1.0" encod