Skip to content


Platform 6 logging Consumer receives and filters log4j events.

log4j is the logging framework used by platform6. Other logging frameworks such as jdk, slf4j and commons are also redirected to log4j as are stdout and stderr streams. This means that nearly everything logged or written to an output stream by core p6 code, third-party libraries or Groovy scripts is captured.

For more information about log4j 1.2 see this:

A custom log4j appender called ‘platform6’ is defined in the file:

log4j.appender.platform6 = com.amalto.b2box.core.impl.logging.B2boxAppender

This appender will generate events via the p6log component and allows low level filtering by logger Level and Logger Name

Common Usage Scenarios

Email Errors to an Operator

All ERROR level logs are captured, stored and sent as xml to an route endpoint where they are filtered and used to generate an Active Routing Order by the p6route component.

The routing order is typically configured to transform the xml to an html document that is sent as an email body to an operator via the SMTP service

Send log messages to an ELK server

All ERROR and WARN logs are captured in JSON format and posted as strings to the ELASTICSEARCH audit provider

Configuration Attributes

Event Queue

There is an internal queue used to store log events awaiting processing. The size of this queue can be controlled by the following conf attribute:

  • com.amalto.b2box.core.impl.application.camel.p6log.LogConsumer.QueueSize default: “2048”


It is very easy to introduce recursion to your p6log routes especially if the scripts called as a result of an event generate ERRORs! To protect against an out of control recursion a limiter is used. By default, this ensures no more than ten matching log events can be processed within any five second period (additional events will be discarded).

The following conf attributes can be modified to change this default behaviour:

  • com.amalto.b2box.core.impl.application.camel.p6log.LogConsumer.limiter.capacity default:”10”
  • com.amalto.b2box.core.impl.application.camel.p6log.LogConsumer.limiter.resetValue default:”10”
  • com.amalto.b2box.core.impl.application.camel.p6log.LogConsumer.limiter.resetMillis default:”5000”

URI Format



The P6log component supports three options which are described below.

Name Description Default Type
level log4j logger Level >= ERROR string
nameRegex Match required on ‘Logger Name’ string
format Log formatting, either: json, xml or map xml string
persistXml true to store xml in .work cluster false string

Example of an xml formatted log event

This format is historical in design and mirrors the logging events generated by the B2BOX product.

    <time>2018-09-11 17:37:22.950 CEST</time>
    <logger>GROOVYSCRIPT: Simons_MacBook_Pro_local_ScriptModule__GENERATE_ERROR</logger>
    <message>this is an error!</message>


Template: BaseRoute.groovy

${addRoutes} :=

    .description('JSON ERROR Log Listener')
    .to( "p6cmb://scripts?platform6.request.action=execute&id=ErrorLogger" )

Template: BaseRoute.groovy

${addRoutes} :=

    .description('Xml ERROR Log Listener')

.description('Xml ERROR Log Routing Rule')
        .setHeader( 'platform6.request.action').constant('execute')
        .to( 'p6route://scripts')

    .throwException(com.amalto.b2box.core.api.B2boxException,'No matching rule found for item!')


Script ErrorLogger:

def jsonLogError = pipeline.get('body')'myerrorindex', jsonLogError)

Script XmlErrorTest:

def htmlToEmail = xslt.process( "LoggingEvent", resource.get('LoggingEvent'), message.getUsingPipelineRequest() )

def cm = [
    headers: [
        'platform6.request.action': 'invoke',
        'from': '',
        'to': '',
        'subject': '[DEV V5] localhost - Logging Event'
    attachments: [
            headers: [
                name: 'body',
                type: 'text/html'
            bytes: htmlToEmail.getBytes()

def rcm = service.request('', cm)

if( rcm.headers['platform6.response.status'] == 'OK') {
    // Remove the stored logging_event after you processed it
    def item = message.remove( message.getPKUsingPipelineRequest() )
    assert item != null