This documentation is for WSO2 ESB version 4.0.2. View documentation for the latest release.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

With the Log Mediator you can log mediated messages.



Syntax

The log token refers to a <log> element, which may be used to log messages being mediated:

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

UI Configuration

The following options for the Log mediator are available:

General Options of the Log Mediator:
  • Log Category - The Log Mediator supports following log categories:
    • TRACE
    • DEBUG
    • INFO
    • WARN
    • ERROR
    • FATAL

      Tip

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

  • Log Level - The Log mediator has four log levels:
    • Simple - To, From, WSAction, SOAPAction, ReplyTo, MessageID and any properties.
    • Headers - All SOAP header blocks and any properties.
    • Full - All attributes are included in log level "simple" and the SOAP envelope and any properties.
    • Custom - The 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
Properties of the Log Mediator

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 such several 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.

Properties Characteristics:

  • Property Name - Name for the property.
  • Property Value - The type of the property value, possible candidates are Value/Expression.
    • Value - A static text message.
    • Expression - An XPath expression executed on each mediating message.
  • Value/Expression - The text or an expression you want to log.
  • Name Space Editor - You can click on this link to add namespaces if you are providing an expression. You will be provided another panel named "Namespace Editor" where you can provide any number of namespace prefixes and URL that you have used in the XPath expression. See Namespace.

  • Action - Deletes the property.

Note

You can configure the Mediator using XML. Click on "switch to source view" in the "Mediator" window.


Example

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 example, it logs everything including the full SOAP message.

  • No labels