Thing which seemed very Thingish inside you is quite different when it gets out into the open and has other people looking at it

Wednesday, May 8, 2013

How to enable tenant aware service logging using WSO2 ESB

Unlike in other WSO2 products (WSO2 Appserver, WSO2 Data Services,  ect) we will not be able to see the application/service level logs  in ESB by default in ESB. Mainly because in the current carbon logging framework is  tenantaware and synapse is not multi tenanted and it runs on its own worker thread pool and does not know aboout the carbon context. Since it uses an independent thread pool from the carbon context logging does not work as expected with NHTTP. Therefore, to overcome this we wrote a handler call TenantDomainSetter which will set the tenant infomation/application infomation in the carbon context of each request.

To enable this you need to go to CARBON_HOME/repository/conf/axis2/axis2.xml and add the TenantDomainSetter in the prefetch of the request path (PreDispatch).

<handler name="TenantDomainSetter" class="org.wso2.carbon.utils.logging.handler.TenantDomainSetter"/>

Once you do that restart WSO2 ESB then you will be able to see service specific logs in LogViewer (monitor -> View Application Logs) which will show the logs of ESB proxy service logs. However application log viewer DOES NOT filter out Sequances, APIs, which are components inside a proxy service ... it will ONLY list down the proxy services.

Application Logs

System Logs

Please note since we are setting the tenant domain for every request there will be an aditional overhead in ESB.. if you want to minimize the overhead its recomended to switch of TenantDomainSetter and use ESB.

No comments:

Post a Comment