Thursday, December 17, 2015

WSO2 Carbon LogViewer Admin Service

Most of the WSO2 Products contains so many Admin Services. All of the available admin services can be seen by starting the server with -DosgiConsole command as guided in documentation [1]

In those admin services, there is an Admin service called "LogViewer". This service provides so many operations as listed in WSDL. In order to access this WSDL locally, you need to change the carbon.xml file as mentioned in link [1]

In those operations, "getApplicationLogs " operation can be used to filter out logs about deployed carbon applications.

Eg: In WSO2 ESB, when we deploy a carbon application, it will print a log like bellow.

[2015-12-17 14:01:07,531]  INFO - ApplicationManager Undeploying Carbon Application : LocalEntryTestProject...
[2015-12-17 14:01:07,552]  INFO - ApplicationManager Successfully Undeployed Carbon Application : LocalEntryTestProject {super-tenant}

[2015-12-17 14:01:22,558]  INFO - LocalEntryDeployer LocalEntry named 'foo1' has been undeployed

So, with the above operation in "Log Viewer" admin service, we can obtain all the logs related to Carbon application deployment.

To verify this we can access this Admin Service with SOAP UI as bellow and provide required input parameters and get the log.

It is important to have proper input parameters to use this admin service.

With the provided input parameters, it filters out the complete log and returns the filtered log.
Type - The log type, It can be ALL, DEBUG, INFO, ERROR, WARN
keyword - This string will be searched in the log and it will return only this keyword presents in the log
appName - This is the application name to be used. We can keep this blank, if we dont know the specific app name
domain - This is the tenant domain, For super admin, the domain is "carbon.super". For others, we can use the proper tenant domain.

serverKey - What is the server we expect to get the log. eg: ESB, AS, GREG