[
https://issues.apache.org/activemq/browse/SM-1315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Bruce Snyder resolved SM-1315.
------------------------------
Resolution: Fixed
Committed fix to the 3.2 branch and the trunk (3.3).
> Enhance logging inside TraceComponent.java to log NormalizedMassage properties
> ------------------------------------------------------------------------------
>
> Key: SM-1315
> URL: https://issues.apache.org/activemq/browse/SM-1315
> Project: ServiceMix
> Issue Type: Improvement
> Affects Versions: 3.2, 3.2.1
> Reporter: Bruce Snyder
> Assignee: Bruce Snyder
> Fix For: 3.2.2, 3.3
>
> Attachments: TraceComponent.java.diff.txt
>
>
> Add more logging to TraceComponent.java, for the following:
> * NormalizedMassage.getPropertyNames(): get the objects in some string format.
> * If NormalizedMassage.getProperty() is of type javax.xml.transform.Source,
> convert the type of a String for logging
> See below code for possible example:
> {code:java}
> /**
> * Outputs the properties on the [EMAIL PROTECTED] NormalizedMessage}.
> Properties of
> * type [EMAIL PROTECTED] Source} are transformed to a [EMAIL PROTECTED]
> String} before
> * being output.
> *
> * @param message The [EMAIL PROTECTED] NormalizedMessage} to be processed
> */
> @SuppressWarnings("unchecked")
> protected void outputProperties(NormalizedMessage message) {
> // Loop over all the properties on the normalized message
> for (Object o : message.getPropertyNames()) {
> // NormalizedMessage API does not use generics. This interface is
> // written in Java older than 5.0. On the basis of other methods
> and
> // the default implementation of this interface we can assume that
> // only String keys are allowed.
> String key = (String) o;
> try {
> Object contents = message.getProperty(key);
> // Is this the only value type that we would like to treat
> // differently? The default behavior is to invoke toString()
> on
> // the object.
> if (contents instanceof Source) {
> contents = getSourceTransformer().toString((Source)
> contents);
> }
> log.info("Value for property '" + key + "' is: " + contents);
> } catch (TransformerException e) {
> log.error("Failed to turn property '" + key + "' value into
> text: " + e, e);
> }
> }
> }
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.