View Source

{section}
{column}

h1. Logging in Petals ESB

Petals uses the logger provided by the JDK.
The logger configuration file, named loggers.properties, is located in $PETALS_HOME/*conf* folder
{column}
{column:width=350px}

{panel:title=Petals logging Documentations}{children:all=true}{panel}
{panel:title=Contributors}{contributors:order=name|mode=list}{panel}
{column}
{section}

h2. Petals Logger Levels

Petals defines a specific level: MONIT.

MONIT level can be used by a log parser to monitor the exchange in Petals ESB.


The levels provided by Petals in descending order are:
* SEVERE (highest value)
* WARNING
* INFO
* CONFIG
* *MONIT*
* FINE
* FINER
* FINEST (lowest value)

The default root logger level is WARNING. It means that all classes log only SEVERE and WARNING information.

You can enable logging and specify a specific level for each module (container, component, cdk...). Here is how you would set debugging from Petals. You would need to ensure the Handler's level is also set to collect this threshold, so FINEST or ALL should be set.
{code}
##Petals level
Petals.level = FINEST

#Handler Configuration
java.util.logging.ConsoleHandler.level = FINEST
{code}

Example of configuration to debug (Level FINEST) petals-bc-soap component:
{code}
##Petals level
Petals.level = INFO #Log level for all petals services
Petals.Container.Components.petals-bc-soap.level = FINEST #Log level for petals-bc-soap component

#Handler Configuration
java.util.logging.ConsoleHandler.level = FINEST
{code}

h2. Petals formatters

Petals provides two formatters: PetalsSimpleFormatter and PetalsExtendedFormatter.

PetalsSimpleFormatter uses the following pattern:
{panel:borderStyle=solid}{+}YYYY/MM/DD+ +HH:MM:SS,FFF+ +LOG LEVEL+ +LOGGER NAME+ : ?\[LOG MESSAGE\]
\[EXTRA DATA KEY\] = '\[EXTRA DATA VALUE\]'
\[JAVA EXCEPTION\]{panel}


PetalsExtendedFormatter is used to log message content (payload XML of SOAP or JBI Message), attachments name and properties.

The pattern of PetalsExtendedFormatter inherits from the pattern of PetalsSimpleFormatter.

*Example of logging output with PetalsSimpleFormatter:*
{panel:borderStyle=solid}
2011/03/16 14:04:20,829 MONIT [Petals.Container.Components.petals-bc-soap|Petals.Container.Components.petals-bc-soap] : External request received
client = '192.168.1.95'
processBranchId = '0'
processInstanceId = 'petals:uid:e871ffb0-4fcd-11e0-b428-00123feb3632'
processLoopId = '0'
requestedUrl = 'http://192.168.1.95:8080/petals/services/LoggerDemoService/'
traceCode = 'MON005'
{panel}

*Example of logging output with PetalsExtendedFormatter:*
{panel:borderStyle=solid}
2011/03/16 15:57:33,798 MONIT [Petals.Container.Components.petals-bc-soap|Petals.Container.Components.petals-bc-soap] : External request received
attachmentNames = ''
client = '192.168.1.95'
processBranchId = '0'
processInstanceId = 'petals:uid:b95be910-4fdd-11e0-b678-00123feb3632'
processLoopId = '0'
requestedUrl = 'http://192.168.1.95:8080/petals/services/LoggerDemoService/'
soapEnvelope = '<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:log="http://petals.ow2.org/bpel/LoggerDemo/"><soapenv:Body>
<log:LoggerDemoRequest>
<log:input>test</log:input>
</log:LoggerDemoRequest>
</soapenv:Body></soapenv:Envelope>'
traceCode = 'MON005'
{panel}

{builder-infopanel:The performance of Petals ESB is reduced when the PetalsExtendendFormatter is activate.}
{info:title=Default behavior}One or both previous formatters are always used during execution, unless default handler formatters in ../conf/logger.properties are changed
{info}
If following formatter is applied for both handlers:

*java.util.logging.FileHandler.formatter = org.ow2.petals.commons.logger.PetalsSimpleFormatter*
*java.util.logging.ConsoleHandler.formatter = org.ow2.petals.commons.logger.PetalsSimpleFormatter*

All logs are processed by the PetalsSimpleFormatter whether we are in _FINEST{_}_, SEVERE, CONFIG ... MONIT_, but

the both previous log traces are written if the level *MONIT* is precised.

h2. Specifics log informations

Following informations are +common{+}{+}s+ to both formatters:
* Timestamp
* Logger level
* Logger component name
* Log message
* Process branch identifier
* Process instance identifier
* Process loop identifier
* Trace code

We can found more informations about previous concepts in glossary [Glossary|http://doc.petalslink.com/display/glossary/Petals+ESB+specific+vocabulary]



After that, _Extended_ formatter allows to precise more detailled informations, as with SOAP component,

we can recover following additionnal informations:
* Requested URL
* Soap enveloppe content
* Attachment names
* Client IP
{tip:title=Multiple formatter utilizations}We can also use both formatter for different purposes like, if you don't want too much information in Petals console, we can keep the "Simple" formatter with following property java.util.logging.ConsoleHandler.formatter = org.ow2.petals.commons.logger.PetalsSimpleFormatter


And if you want more detailled informations accessible at all times prefer the "Extended" formatter in Petals log file with following property
java.util.logging.FileHandler.formatter = org.ow2.petals.commons.logger.PetalsExtendedFormatter{tip}


{column}