WSO2 ESB - Log Mediator

Log Mediator

With the log mediator, you can log messages being mediated.

Log Category

Log Mediator supports following log categories.Log messages will be logged in log4j with selected log category. The default log category is INFO

Log Levels

Log mediator has four log levels

  1. simple = To, From, WSAction, SOAPAction, ReplyTo, MessageID and any properties
  2. headers = All SOAP header blocks and any properties
  3. full = all attributes included in log level 'simple' and the SOAP envelope and any properties
  4. custom = Only properties specified to the Log mediator

Log Separator

A separator if defined will be used to separate the attributes being logged. The default separator is the ',' comma

Log Properties

With properties, user can choose any other attributes that they want to log. Imagine there is an element carrying the transaction id in the SOAP body. User can use a XPath expression to extract out this transaction id element and log it using the log mediator. It is possible to define several such properties to be logged.

If properties are specified with any of the first three log levels, custom properties will be logged along with the default ones.

Syntax

 <log [level="string"] [separator="string"]>
   <property name="string" (value="literal" | expression="xpath")/>*
 </log>

UI Configuration

Log Mediator

Figure1: Log Mediator

Log Category

You can select the log category to be one of following values.

Log Level

You can select the log level to be one of following values.

Log Separator

The log separator is used to separate the attributes being logged. The default separator is ',' (comma).

Adding Properties

You can add custom messages to log as the messages mediate thorough the log mediator.

Log Mediator Properties

Figure2: Log Mediator Properties

Example

  <log level="custom" xmlns="http://ws.apache.org/ns/synapse">
      <property name="text"
                expression="fn:concat('Stock price - ',get-property('stock_price'))"/>
  </log>

In this example log level is set to custom. It logs the property stock_price that is set previously in the message mediation.

 
  <log level="full" xmlns="http://ws.apache.org/ns/synapse"/>

In the previous example it logs evething including the full SOAP message.