4. Monitoring, Logging and Statistics

log

Version

Logs request and response messages. The messages will appear either on the console or in a log file depending on the log configuration.

Typical use cases:

  • Debugging APIs during development.
  • Operational visibility in production (metadata-only, masked values, message, body).

Syntax

<log body="[false,true]" category="[string]" level="[TRACE,DEBUG,INFO,WARN,ERROR,FATAL]" />
<log message="Path: ${path}" />
<log body="[false,true]" category="[string]" level="[TRACE,DEBUG,INFO,WARN,ERROR,FATAL]" />
<log message="Path: ${path}" />

Sample

<serviceProxy port="2000">
<request>
<log />
</request>
<target host="www.predic8.de" />
</serviceProxy>
<serviceProxy port="2000">
  <request>
	<log />
  </request>
  <target host="www.predic8.de" />
</serviceProxy>

Attributes

NameRequiredDefaultDescriptionExamples
bodyfalsetrueWhether to include message bodies in logs.

Warning: Body logging can expose secrets or personal data. Prefer false in production.

-
categoryfalseFully qualified class name of LogInterceptor com.predic8.membrane.core.interceptor.log.LogInterceptorLogger category to use.

Allows routing logs into different appenders/targets via Logback/Log4j configuration.

-
headerOnlyfalsefalseIgnored. Still there for compatibility.-
labelfalseempty stringShort label printed with each log line to distinguish multiple log interceptors.

Useful when several APIs share the same category but you want quick visual grouping.

"After Transformation"
languagefalseSpELthe language of the 'test' conditionSpEL, groovy, jsonpath, xpath
levelfalseINFOLog level for emitted messages.

Values: TRACE, DEBUG, INFO, WARN, ERROR, FATAL

WARN
maskSensitivefalse-Whether to mask sensitive header values (e.g., Authorization, Cookies, API keys).

When enabled (default), values are replaced by ****.

-
messagefalse---

Can be used in