سؤال

I've created a Custom Proxy and added a class mediator and log Mediator in it. I'm trying to set a property's value in the java class and need to write that in the log, as the proxy gets deployed. But, so far, haven't got any success.

I've tried adding a parameter in the Log mediator and used the get-property() method but it still doesn't print it. If I use a 'Property' mediator itself, then I'm able to write the value in the log but that's not our purpose here.

I've also tried using log.debug in the java class, just to write the usual 'entering/exiting a function', but to no respite.

Could anyone please help?

هل كانت مفيدة؟

المحلول

How are you setting a property in the java class(ie: in your class mediator)? It should be like;

synapseMesssageContext.setProperty(key,value);

Then,In the sequence flow access it as;

<property xmlns:ns="http://org.apache.synapse/xsd"   name="testing the property"
                expression="get-property('key')"   scope="default"/>

نصائح أخرى

You can use log.info to print any log messages. Please reffer [1] which has logged messages using log.info.

[1]http://wso2.org/library/2898

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top