|
xmlBlaster 2.2.0 API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xmlBlaster.util.checkpoint.Checkpoint
public class Checkpoint
Plugin to trace the message flow into log files.
Currently there are 4 checkpoints defined inside the xmlBlaster core (see
I_Checkpoint.java).
You can add a client property (e.g. "wfguid") to your PublishQos and register
this here with filterClientPropertyKey="wfguid". When such a marked message
passes one of the checkpoints a logging entry will be written to a log file
(as configured in logging.properties). See logging.properties for examples
on how to control which checkpoints are logged and if the complete message
shall be dumped.
Is adjustable during runtime using JMX (jconsole)
Needs to be loaded in xmlBlasterPlugins.xml at run level 1:
<plugin create='true' id='Checkpoint' className='org.xmlBlaster.util.checkpoint.Checkpoint'> <action do='LOAD' onStartupRunlevel='1' sequence='1' onFail='resource.configuration.pluginFailed'/> <action do='STOP' onShutdownRunlevel='0' sequence='1'/> <attribute id='filterClientPropertyKey'>wfguid</attribute> <attribute id='xmlStyle'>true</attribute> <attribute id='showAllMessages'>false</attribute> <attribute id='showAllClientProperties'>false</attribute> </plugin>If showAllMessages is set to true all messages are logged and the filter is ignored.
A typical log entry looks like this:
Oct 20, 2007 7:14:29 PM org.xmlBlaster.util.checkpoint.Checkpoint passingBy INFO: <cp>publish.ack</cp> <topicId>Hello</topicId> <wfguid>234345667777</wfguid> <sender>client/Publisher/1</sender>or if you set xmlStyle to false like this:
Oct 20, 2007 7:26:46 PM org.xmlBlaster.util.checkpoint.Checkpoint passingBy INFO: [cp=update.ack] [topicId=Hello] [wfguid=234345667777] [sender=client/Publisher/1] [destination=client/Subscribe/1]You can extend this class and change the output style by overwriting the method append()
| Field Summary | |
|---|---|
protected ContextNode |
contextNode
|
protected java.lang.String[] |
excludeIfKeys
If given messages containing such keys are not logged |
protected java.lang.String |
filterClientPropertyKey
If given will be used to filter which messages are logged |
protected java.lang.String[] |
filterKeys
Is parsed from comma separated list of filterClientPropertyKey |
private Global |
glob
|
private static java.util.logging.Logger |
log
Normal logging |
protected java.lang.String |
log4jConfiguration
|
protected org.apache.commons.logging.Log[] |
loggers
Checkpoint logging |
protected java.lang.String |
logImpl
|
protected java.lang.Object |
mbeanHandle
My JMX registration |
private java.lang.String |
ME
|
private PluginInfo |
pluginInfo
xmlBlasterPlugins.xml awareness |
private boolean |
running
|
private ServerScope |
serverScope
|
protected boolean |
showAllClientProperties
|
protected boolean |
showAllMessages
If false show only messages marked by filterClientPropertyKey=wfguid |
private boolean |
shutdown
|
protected boolean |
xmlStyle
|
| Fields inherited from interface org.xmlBlaster.util.checkpoint.I_Checkpoint |
|---|
CP_CONNECTION_PUBLISH_ACK, CP_CONNECTION_PUBLISH_ENTER, CP_NAMES, CP_PUBLISH_ACK, CP_PUBLISH_ENTER, CP_UPDATE_ACK, CP_UPDATE_QUEUE_ADD |
| Constructor Summary | |
|---|---|
Checkpoint()
|
|
| Method Summary | |
|---|---|
void |
activate()
Activate this service |
protected void |
append(java.lang.StringBuilder buf,
java.lang.String key,
java.lang.String value)
Format the key/value output. |
void |
deActivate()
Deactivate the service to standby. |
java.lang.String |
getCheckpointList()
A comma separated list of checkpoints used |
java.lang.String |
getFilter()
|
java.lang.String |
getType()
The unique name of the plugin (together with the version). |
java.lang.String |
getUsageUrl()
|
java.lang.String |
getVersion()
The version of the plugin |
void |
init(Global glob,
PluginInfo pluginInfo)
This method is called by the PluginManager. |
boolean |
isActive()
Access the current state |
private boolean |
isClusterEnvironment()
|
boolean |
isShowAllClientProperties()
|
boolean |
isShowAllMessages()
|
boolean |
isShutdown()
Check status |
boolean |
isXmlStyle()
|
void |
passingBy(int checkpoint,
MsgUnit msgUnit,
SessionName destination,
java.lang.String[] context)
A message is passing a checkpoint. |
void |
setExcludeIf(java.lang.String excludeIfClientPropertyKey)
If one of the keys is found the checkpoint is not logged. |
void |
setFilter(java.lang.String filterClientPropertyKey)
A key (or a key-list) of a ClientProperty, only those messages containing such a ClientProperty are logged |
void |
setShowAllClientProperties(boolean showAllClientProperties)
|
void |
setShowAllMessages(boolean showAllMessages)
|
void |
setUsageUrl(java.lang.String url)
|
void |
setXmlStyle(boolean xmlStyle)
|
void |
shutdown()
Shutdown the plugin, free resources. |
java.lang.String |
usage()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.lang.String ME
private Global glob
private ServerScope serverScope
private static java.util.logging.Logger log
protected org.apache.commons.logging.Log[] loggers
fatal error warn info debug trace
http://commons.apache.org/logging/guide.html#Quick%20Startprivate PluginInfo pluginInfo
private boolean running
private boolean shutdown
protected java.lang.Object mbeanHandle
protected ContextNode contextNode
protected java.lang.String[] excludeIfKeys
protected java.lang.String filterClientPropertyKey
protected java.lang.String[] filterKeys
protected boolean showAllClientProperties
protected boolean showAllMessages
protected boolean xmlStyle
protected java.lang.String log4jConfiguration
protected java.lang.String logImpl
| Constructor Detail |
|---|
public Checkpoint()
| Method Detail |
|---|
public void passingBy(int checkpoint,
MsgUnit msgUnit,
SessionName destination,
java.lang.String[] context)
I_Checkpoint
passingBy in interface I_Checkpointcheckpoint - The checkpoint, e.g. CP_PUBLISH_ACKmsgUnit - The message processeddestination - Can be nullcontext - Additional key values like { "subscriptionId", "__suvbId:2349", "comment", "blabla" }
protected void append(java.lang.StringBuilder buf,
java.lang.String key,
java.lang.String value)
buf - key - value -
public void init(Global glob,
PluginInfo pluginInfo)
throws XmlBlasterException
I_Plugin
// An entry in xmlBlaster.properties (in one line):
MimeSubscribePlugin[ContentLenFilter][1.0]=\
org.xmlBlaster.engine.mime.demo.ContentLenFilter,\
DEFAULT_MAX_LEN=200,DEFAULT_MIN_LEN=20
// Access it like this:
java.util.Properties props = pluginInfo.getParameters();
String maxLen = (String)props.get("DEFAULT_MAX_LEN");
String throwLen = (String)props.get("THROW_EXCEPTION_FOR_LEN");
init in interface I_PluginXmlBlasterExceptionprivate final boolean isClusterEnvironment()
public java.lang.String getType()
I_AdminPlugin
getType in interface I_AdminPlugingetType in interface I_Pluginpublic java.lang.String getVersion()
I_AdminPlugin
getVersion in interface I_AdminPlugingetVersion in interface I_Plugin
public void shutdown()
throws XmlBlasterException
I_AdminPlugin
shutdown in interface I_AdminPluginshutdown in interface I_PluginXmlBlasterException - if an exception occurs. The exception is
handled by the RunLevelManager depending on how the plugin has been
configured with the action:
<action do='STOP' onShutdownRunlevel='2' sequence='5'
onFail='resource.configuration.pluginFailed'>
If onFail is defined to something, the RunLevelManager will stop.public java.lang.String getCheckpointList()
CheckpointMBean
getCheckpointList in interface CheckpointMBean
public void activate()
throws java.lang.Exception
I_AdminService
activate in interface I_AdminServicejava.lang.Exceptionpublic void deActivate()
I_AdminService
deActivate in interface I_AdminServicepublic boolean isActive()
I_AdminService
isActive in interface I_AdminServicepublic boolean isShutdown()
I_AdminPlugin
isShutdown in interface I_AdminPluginpublic java.lang.String getUsageUrl()
getUsageUrl in interface I_AdminUsagepublic void setUsageUrl(java.lang.String url)
setUsageUrl in interface I_AdminUsagepublic java.lang.String usage()
usage in interface I_AdminUsagepublic boolean isShowAllClientProperties()
isShowAllClientProperties in interface CheckpointMBeanpublic void setShowAllClientProperties(boolean showAllClientProperties)
setShowAllClientProperties in interface CheckpointMBeanshowAllClientProperties - the showAllClientProperties to setpublic boolean isShowAllMessages()
isShowAllMessages in interface CheckpointMBeanpublic void setShowAllMessages(boolean showAllMessages)
setShowAllMessages in interface CheckpointMBeanshowAllMessages - If set to true the getFilter() is ignoredpublic java.lang.String getFilter()
getFilter in interface CheckpointMBeanpublic void setFilter(java.lang.String filterClientPropertyKey)
setFilter in interface CheckpointMBeanfilterClientPropertyKey - A client property key like "wfguid" or a comma separated list of keys
like "transId,wfguid,guid"public void setExcludeIf(java.lang.String excludeIfClientPropertyKey)
excludeIfClientPropertyKey - comma separated listpublic boolean isXmlStyle()
isXmlStyle in interface CheckpointMBeanpublic void setXmlStyle(boolean xmlStyle)
setXmlStyle in interface CheckpointMBeanxmlStyle - the xmlStyle to set
|
xmlBlaster 2.2.0 API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||