Search code examples
wso2wso2-integration-studiowso2-esb

How to pick service name in WSO2 using Log Mediator


I am using WSO2 ESB 4.8.1. When i use log mediator, i want it to also log the proxy service name in which log mediator is being used. Is there any property defined in wso2 that i can use?

Problem:

In the following log mediator I am using "Server_IP" and "Server_HOST" property to pick up the Server IP and Server Host name. So is there any property from which i can pick up the service name.

Log Mediaator:

 <log level="full" separator="LogMediator" description="LoggerTemplate">
    <property name="ServerIP" expression="get-property('SERVER_IP')"/>
    <property name="ServerHost" expression="get-property('SERVER_HOST')"/>
    </log> 

Solution

  • Yes. Use the $ctx:proxy.name expression for your property mediator:

    <log level="custom"> 
        <property name="proxyName" expression="$ctx:proxy.name"/>
    </log>
    

    Output:

    [2015-02-06 06:24:07,161] INFO - LogMediator proxyName = vfsTest