Petals Logging specificities
Level 'MONIT'
Petals defines a specific level: MONIT, that can be used by a log parser to monitor the exchanges in Petals ESB.
The level MONIT is inserted between levels CONFIG and FINE:
- SEVERE (highest value)
- WARNING
- INFO
- CONFIG
- MONIT
- FINE
- FINER
- FINEST (lowest value)
Moreover standard information of each log level, a MONIT level trace is accompanied by following information:
- a trace code identifying the nature of the MONIT trace. See below the list of trace code.
- a process instance identifier identifying the process instance,
- a process loop identifier identifying the loop instance in which the service provider is invoked,
- a process branch identifier identifying the branch instance in which the service provider is invoked,
- specific information to the trace code
- a text message explaining the event
- if the extended mode is enabled: the reference where the message content is stored. The content stored is defined accordingly to the trace code.
Trace code |
Description | Specific information |
Message content stored |
---|---|---|---|
MON-001 | A service associated to an internal endpoint receives an incoming request. |
|
|
MON-002 | An endpoint invokes a service provider |
|
|
MON-003 | A service provider returns a reply to the caller |
|
|
MON-004 | A service consumer receives a reply from a service provider |
- |
|
MON-005 | A binding component receives an incoming request from outside |
|
|
MON-006 | A binding component invokes an external service provider |
|
|
MON-007 | A binding component receives a reply from an external service provider | - |
|
MON-008 | A binding component returns a reply to an external service consumer |
- |
|
Default levels
The default root logger level is WARNING. It means that all classes log only SEVERE and WARNING information.
The default Petals root logger level is INFO. That's why all Petals components will log only SEVERE, WARNING and INFO 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.
##Petals level Petals.level = FINEST #Handler Configuration java.util.logging.ConsoleHandler.level = FINEST
Example of configuration to debug (Level FINEST) petals-bc-soap component:
##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
Petals formatters
Petals provides two formatters: PetalsSimpleFormatter and PetalsExtendedFormatter.
PetalsSimpleFormatter uses the following pattern:
YYYY/MM/DD HH:MM:SS,FFF LOG LEVEL LOGGER NAME : ?[LOG MESSAGE]
[EXTRA DATA KEY] = '[EXTRA DATA VALUE]'
[JAVA EXCEPTION]
PetalsExtendedFormatter is used to log message content (payload XML of SOAP or JBI Message), attachment names and properties.
The pattern of PetalsExtendedFormatter inherits from the pattern of PetalsSimpleFormatter.
Example of logging output with PetalsSimpleFormatter:
2011/03/16 14:04:20,829 MONIT [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'
Example of logging output with PetalsExtendedFormatter:
2011/03/16 15:57:33,798 MONIT [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'
Default behavior One or both previous formatters are always used during execution, unless default handler formatters in ../conf/logger.properties are changed |
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.
Splitting log files
Petals ESB allow to split its log records into a log files hierarchy. This is done thanks to the ContextualFileHandler which can redirect log records to separate according to Petals ESB runtime properties.
In addition to standard Handler properties (level, formatter, etc..), ContextualFileHandler can be configured through the following extra properties :
* basedir : base directory where log files will be stored. Default value (if no property set) is user home directory.
* subdir : sub directory relative to basedir where log file will be stored. Default value (if no property set) is empty sub directory.
* logFilename : log filename to use.
Both subdir and logFilename properties are dynamically evaluated each time a log record is written, and thus can use the following runtime properties :
* processInstanceId
* componentName
Logged informations
Following informations are commons 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
After that, Extended formatter allows to precise more detailed informations, as with SOAP component,
we can recover following additional informations:
- Requested URL
- Soap envelope content
- Attachment names
- Client IP adress
Multiple formatter utilizations
We can also use both formatter for different purposes
- 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
- 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
Environment variable
Take in account if the following variable is define or not:-Djava.util.logging.config.file=$PETALS_HOME/conf/loggers.properties"
Because, if the previous argument on your Petals process is setted to another logging file, the loggers.properties under /conf will not be take in account.
This setting can create a real problem, you do not necessarily understand where it comes directly
Appendix
Default loggers.properties
The default loggers.properties is :
# PETALS: PETALS Services Platform # Copyright (C) 2005 EBM WebSourcing # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA. # # Initial developer(s): EBM WebSourcing handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler java.util.logging.FileHandler.level = FINEST java.util.logging.FileHandler.pattern = ${petals.home}/logs/petals.log java.util.logging.FileHandler.formatter = org.ow2.petals.commons.logger.PetalsSimpleFormatter java.util.logging.FileHandler.append = true java.util.logging.ConsoleHandler.level = FINEST java.util.logging.ConsoleHandler.formatter = org.ow2.petals.commons.logger.PetalsSimpleFormatter com.ebmwebsourcing.easycommons.logger.handler.ContextualFileHandler.level=FINEST com.ebmwebsourcing.easycommons.logger.handler.ContextualFileHandler.basedir=${petals.home}/logs/ com.ebmwebsourcing.easycommons.logger.handler.ContextualFileHandler.subdir=${componentName}/${processInstanceId} com.ebmwebsourcing.easycommons.logger.handler.ContextualFileHandler.logFilename=log com.ebmwebsourcing.easycommons.logger.handler.ContextualFileHandler.formatter=com.ebmwebsourcing.easycommons.logger.LogDataFormatter ##Root level .level = FINEST ##Petals level Petals.level = FINEST #Petals.PetalsAdminService.level = FINEST #Petals.AutoLoaderService.level = FINEST #Petals.ConfigurationService.level = FINEST #Petals.Container.level = FINEST #Petals.Container.ContainerService.level = FINEST #Petals.Container.Components.level = FINEST #Petals.Container.Lifecycle.level = FINEST #Petals.Container.Lifecycle.ComponentLifeCycle.level = FINEST #Petals.Container.Lifecycle.Installer.level = FINEST #Petals.Container.Lifecycle.ServiceAssemblyLifeCycle.level = FINEST #Petals.Container.Lifecycle.SharedLibraryLifeCycle.level = FINEST #Petals.Communication.level = FINEST #Petals.Communication.TopologyService.level = FINEST #Petals.Communication.JNDIAgentService.level = FINEST #Petals.Communication.JNDIService.level = FINEST #Petals.Communication.JMXService.level = FINEST #Petals.Communication.RMIConnector.level = FINEST #Petals.Communication.RemoteCheckerClient.level = FINEST #Petals.Tools.WebServiceManager.level = FINEST #Petals.System.level = FINEST #Petals.System.PersistenceService.level = FINEST #Petals.System.LoaderManagerService.level = FINEST #Petals.System.SystemStateService.level = FINEST #Petals.System.RepositoryService.level = FINEST #Petals.System.Artifact.FractalArtifactRepositoryService.level = FINEST #Petals.JBI-Management.level = FINEST #Petals.JBI-Management.AdminService.level = FINEST #Petals.JBI-Management.SystemRecoveryService.level = FINEST #Petals.JBI-Management.InstallationService.level = FINEST #Petals.JBI-Management.ComponentInstallationService.level = FINEST #Petals.JBI-Management.DeploymentService.level = FINEST #Petals.JBI-Management.AtomicDeploymentService.level = FINEST #Petals.JBI-Management.TransactionManager.level = FINEST #Petals.JBI-Messaging.level = FINEST #Petals.JBI-Messaging.RouterMonitorService.level = FINEST #Petals.JBI-Messaging.RouterService.level = FINEST #Petals.JBI-Messaging.FlowControllerModule.level = FINEST #Petals.JBI-Messaging.FlowFilterModule.level = FINEST #Petals.JBI-Messaging.PriorityOrdererModule.level = FINEST #Petals.JBI-Messaging.TransportResolverModule.level = FINEST #Petals.JBI-Messaging.AuthorizationModule.level = FINEST #Petals.JBI-Messaging.EndpointResolverModule.level = FINEST #Petals.JBI-Messaging.JAASAuthenticationModule.level = FINEST #Petals.JBI-Messaging.PriorityOrdererModule.level = FINEST #Petals.JBI-Messaging.EndpointRegistry.level = FINEST #Petals.JBI-Messaging.JMXExchangeCheckerClient.level = FINEST #Petals.JBI-Component.ComponentContext.level = FINEST #Petals.Transporter.level = FINEST #Petals.Transporter.LocalTransporter.level = FINEST #Petals.Transporter.NioTransporter.level = FINEST #Petals.Transporter.NioTransportProtocol.NioSelectorAgent.level = FINEST #Petals.Transporter.NioTransportProtocol.NioServerAgent.level = FINEST #Petals.Transporter.NioTransportProtocol.NioClientObjectPool.level = FINEST #Petals.WS.level = FINEST #Petals.WS.ArtifactRepositoryService.level = FINEST #Petals.WS.DeploymentService.level = FINEST #Petals.WS.DragonConnectionService.level = FINEST #Petals.WS.EndpointService.level = FINEST #Petals.WS.InformationService.level = FINEST #Petals.WS.InstallationService.level = FINEST #Petals.WS.JBIArtefactsService.level = FINEST #Petals.WS.RuntimeService.level = FINEST #Petals.WS.ServiceAssemblyStateService.level = FINEST #Petals.WS.TopologyService.level = FINEST
Default log4j.properties
The default log4j.properties is :
# Set the options for the Console appender. # Console's layout is a PatternLayout, using the conversion pattern # %d: current date in ISO8601 format # %p: priority of the logging event # %c: category name # %m: the message log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.ConversionPattern=%d %-5p %c{3} %m\n # Root logger set to INFO using the Console appender defined above. log4j.rootLogger=fatal,Console ###################### # Logger definitions # ###################### # CXF logger # #log4j.logger.org.apache.cxf=fatal,Console #log4j.additivity.org.apache.cxf=true # Hibernate logger # log4j.logger.org.hibernate=fatal,Console log4j.additivity.org.hibernate=true # Registry logger # log4j.logger.org.ow2.petals.registry=fatal,Console log4j.additivity.org.ow2.petals.registry=true